Write file in node js var fs = require('fs'); //Replace the file with a new one: fs.writeFile('mynewfile3.txt', 'This is my text.', function (err) { if (err) throw err; console.log('Replaced!'); }); // You can write anything in this file by using writeFile() function You Might Also Like Where condition in node js mysql August 23, 2023 Limit in node mysql August 23, 2023 Create files in node js August 22, 2023 Leave a Reply Cancel replyCommentEnter your name or username to comment Enter your email address to comment Enter your website URL (optional) Save my name, email, and website in this browser for the next time I comment.