Answers for "renaming files in nodejs"

3

fs renaming files

const fs = require("fs")

fs.rename("./testfile.txt", "./newtestfile.txt", (err) => {
	if (err) console.log(err)
})
Posted by: Guest on November-22-2020
0

rename file using node javascript

var fs = require('fs');

fs.rename('mynewfile1.txt', 'myrenamedfile.txt', function (err) {
  
  if (err) throw err;
  console.log('File Renamed!');
});
Posted by: Guest on July-18-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language