- rename
Rename a file (rename)
fs.rename(from, to, (err) => {})
examples/fs/rename_file.js
const fs = require('fs'); fs.rename('old.txt', 'new.txt', (err) => { if (err) { console.log(err); } else { console.log('Success'); } });
fs.rename(from, to, (err) => {})
const fs = require('fs'); fs.rename('old.txt', 'new.txt', (err) => { if (err) { console.log(err); } else { console.log('Success'); } });