Delete file in node js var fs = require('fs'); fs.unlink('mynewfile1.txt', function (err) { if (err) throw err; console.log('File deleted!'); }); It will delete this file 'mynewfile1.txt' after save this code. Cook with me Share this content Opens in a new window X Opens in a new window Facebook Opens in a new window WhatsApp You Might Also Like Event module in node js August 22, 2023 Express js installation August 22, 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.