Created
March 14, 2011 23:28
-
-
Save biilmann/870069 to your computer and use it in GitHub Desktop.
Why does this load the whole ubuntu iso in memory?
This file contains 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 path = "/Users/mbc/Downloads/ubuntu-10.04.1-server-amd64.iso"; | |
var stream = fs.createReadStream(path); | |
var out = fs.createWriteStream('tmp/testing.iso'); | |
stream.on('data', function(data) { | |
console.info("Streaming data "+data.length); | |
out.write(data); | |
}); | |
stream.on('end', function() { | |
console.info("Streaming done"); | |
out.end(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment