Rename file in node js var fs = require('fs'); fs.rename('mynewfile3.txt', 'myrenamedfile.txt', function (err) { if (err) throw err; console.log('File Renamed!'); }); After save this file 'mynewfile3.txt' to 'myrenamedfile.txt'. You Might Also Like Delete file in node js August 22, 2023 File system in node js ( Read file ) August 22, 2023 Create own module 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.