Skip to content

Instantly share code, notes, and snippets.

@TobyEalden
Created October 19, 2016 13:05
Show Gist options
  • Save TobyEalden/b21eea940a47b8910597e316c9565c59 to your computer and use it in GitHub Desktop.
Save TobyEalden/b21eea940a47b8910597e316c9565c59 to your computer and use it in GitHub Desktop.
var filestream = fs.createReadStream(file);
filestream.pipe(res)
.on("finish", function() {
log("resource download complete");
})
.on("error", function(err) {
errLog("failure during resource download: %s", err.message);
});
res
.on("finish", function() {
log("response resource download complete");
})
.on("error", function(err) {
errLog("response failure during resource download: %s", err.message);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment