Zmień nazwę pliku w JS

var fs = require('fs');
 
fs.rename('sample_old.txt', 'sample_new.txt', function (err) {
  if (err) throw err;
  console.log('File Renamed.');
});
Wicked Whale