I have the following code that moves files from one directory to another:
var fs = require('fs'),
oldPath = 'firstfile.txt',
newPath = 'temp/firstfile.txt';
fs.rename(oldPath, newPath, function (err) {
console.log('rename callback ', err);
});
Is it possible to trigger error if newPath
file already exists?
Aucun commentaire:
Enregistrer un commentaire