Rob's Blog

Jack of all trades, master of... some

Category

Node

writeFile, createWriteStream + writing to .json causes node crash

When using the fs module to write to files, sometimes you’re going to write to a JSON file. const contentStream = fs.createWriteStream(            “./src/utilities/corpus/corpora/” + fileName + “.txt”,            {flags: “a”}        ); or fs.writeFile(     “./src/utilities/corpus/corpora/” + fileName + “-master.json”     , JSON.stringify(masterList)     , (err) => {          if (err) { throw err; }         console.log(“Data written to file”);     }); I’ve found that this can cause what seems like node to crash out… Continue Reading →

© 2019 Rob's Blog — Powered by WordPress

Theme by Anders NorenUp ↑