-
-
Save davidguttman/ba96b1cfc0dfff2d4da8 to your computer and use it in GitHub Desktop.
Revisions
-
Spencer-Allen created this gist
Aug 15, 2014 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,32 @@ 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]); }