Created
November 4, 2014 09:16
-
-
Save wmakeev/044804aa573542966143 to your computer and use it in GitHub Desktop.
Move files in Node.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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