upload file create new file to rename file js code example
Example: rename file in js
var fs = require('fs');
fs.rename('sample_old.txt', 'sample_new.txt', function (err) {
if (err) throw err;
console.log('File Renamed.');
});
var fs = require('fs');
fs.rename('sample_old.txt', 'sample_new.txt', function (err) {
if (err) throw err;
console.log('File Renamed.');
});