Skip to content

Instantly share code, notes, and snippets.

@tanyagupta
Created December 6, 2015 21:48
Show Gist options
  • Save tanyagupta/73a09a66afe9f1804023 to your computer and use it in GitHub Desktop.
Save tanyagupta/73a09a66afe9f1804023 to your computer and use it in GitHub Desktop.
HTTP COLLECT (Exercise 8 of 13)
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