Created
December 6, 2015 21:48
-
-
Save tanyagupta/73a09a66afe9f1804023 to your computer and use it in GitHub Desktop.
HTTP COLLECT (Exercise 8 of 13)
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 bl = require('bl'); | |
var http = require('http'); | |
var url = process.argv[2]; | |
http.get(url, function(res) | |
{ | |
res.setEncoding("utf8"); | |
res.pipe(bl(function (err,data) | |
{ | |
if(err) | |
{ | |
console.log('error'); | |
} | |
console.log(data.toString().length); | |
console.log(data.toString()); | |
})) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment