Skip to content

Instantly share code, notes, and snippets.

@knownasilya
Last active January 2, 2016 10:29
Show Gist options
  • Save knownasilya/8289927 to your computer and use it in GitHub Desktop.
Save knownasilya/8289927 to your computer and use it in GitHub Desktop.
http download
var http = require('http');
function download(url, callback) {
http.get(url, function(res) {
var data = "";
res.on('data', function (chunk) {
data += chunk;
});
res.on("end", function() {
callback(data);
});
}).on("error", function() {
callback(null);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment