Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidguttman/ba96b1cfc0dfff2d4da8 to your computer and use it in GitHub Desktop.
Save davidguttman/ba96b1cfc0dfff2d4da8 to your computer and use it in GitHub Desktop.
var http = require('http');
var bl = require('bl');
var urls = [];
process.argv.slice(2).forEach(function(item){
urls.push(item)
});
console.log (urls)
var getter = function(url, index){
results = []
http.get(url, function(response) {
response.setEncoding('utf8');
response.pipe(bl(function(err, data){
if (err) {
return;
}
results.splice(index, 0, data.toString());
}));
});
}
for (var x=0; x < urls.length - 1; x++){
var answer = getter(urls[x], x)
}
for (y in results){
console.log(results[y]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment