Skip to content

Instantly share code, notes, and snippets.

@biilmann
Created March 14, 2011 23:28
Show Gist options
  • Save biilmann/870069 to your computer and use it in GitHub Desktop.
Save biilmann/870069 to your computer and use it in GitHub Desktop.
Why does this load the whole ubuntu iso in memory?
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