From b03d1ddc548cb27570ccbed46e0cb669daa35c49 Mon Sep 17 00:00:00 2001 From: Chuanqi Sun Date: Sat, 2 Sep 2023 10:48:14 -0700 Subject: [PATCH] ensure file name uniqueness --- packages/tools/markdown-converter/haiku-to-md.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/tools/markdown-converter/haiku-to-md.js b/packages/tools/markdown-converter/haiku-to-md.js index 502dcc2..f33edfd 100644 --- a/packages/tools/markdown-converter/haiku-to-md.js +++ b/packages/tools/markdown-converter/haiku-to-md.js @@ -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" }); }); } }