Skip to content

Instantly share code, notes, and snippets.

@wmakeev
Created November 4, 2014 09:16
Show Gist options
  • Save wmakeev/044804aa573542966143 to your computer and use it in GitHub Desktop.
Save wmakeev/044804aa573542966143 to your computer and use it in GitHub Desktop.
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');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment