Skip to content

Instantly share code, notes, and snippets.

@rsoares
Created August 2, 2014 14:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rsoares/4bf2140e1c5b30dfcbff to your computer and use it in GitHub Desktop.
Save rsoares/4bf2140e1c5b30dfcbff to your computer and use it in GitHub Desktop.
var http = require( "http" ),
args = process.argv.slice(2),
mimicAsync = [],
result = [],
j = 0;
args.forEach( function( url, index ) {
http.get( url, function( response ) {
var stream = "";
response.setEncoding( "utf8" );
response.on( "data", function( data ) {
stream += data;
});
response.on( "end", function() {
result[index] = stream;
if( args.length === j+1 ) {
result.forEach( function( data ) {
console.log( data );
});
}
j++;
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment