Created
September 22, 2013 13:24
-
-
Save zhuangya/6659871 to your computer and use it in GitHub Desktop.
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 characters
| var http = require('http'); | |
| var urls = process.argv.slice(2); | |
| var bufferString = ''; | |
| var counter = 0; | |
| var canContinue = true; | |
| while(!!urls.length && canContinue) { | |
| currentUrl = urls.shift(); | |
| http.get(currentUrl, function(req) { | |
| req.setEncoding('utf-8'); | |
| req.on('data', function(res) { | |
| canContinue = false; | |
| bufferString = bufferString + res; | |
| }).on('end', function() { | |
| canContinue = true; | |
| console.log(bufferString); | |
| bufferString = ''; | |
| }); | |
| }); | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment