Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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