Skip to content

Commit

Permalink
ensure file name uniqueness
Browse files Browse the repository at this point in the history
  • Loading branch information
Chuanqi Sun committed Sep 2, 2023
1 parent 7f62b2f commit b03d1dd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/tools/markdown-converter/haiku-to-md.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ async function main(inputDir) {

// TODO pass through markdown and yaml parser

await fs.writeFile(path.join(__dirname, `./output/${timeId}.md`), `${frontmatter}\n\n${body}\n`);
// `wx` flag: fail if file exists
await fs.writeFile(path.join(__dirname, `./output/${timeId}.md`), `${frontmatter}\n\n${body}\n`, { flag: "wx" });
});
}
}
Expand Down

0 comments on commit b03d1dd

Please sign in to comment.