Created
August 15, 2014 03:38
-
-
Save Spencer-Allen/56e8b9a599e7b22e8eab to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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