wmakeev
11/4/2014 - 9:16 AM

Move files in Node.js

Move files in Node.js

var fs = require('fs');

var is = fs.createReadStream('source_file');
var os = fs.createWriteStream('destination_file');

is.pipe(os);
is.on('end',function() {
    fs.unlinkSync('source_file');
});