Skip to content

Instantly share code, notes, and snippets.

@queckezz
Last active December 23, 2015 20:09
Show Gist options
  • Save queckezz/6687167 to your computer and use it in GitHub Desktop.
Save queckezz/6687167 to your computer and use it in GitHub Desktop.
Simple Buffer collector example
var http = require('http');
var url = process.argv[2];
http.get(url, function (res) {
//res.setEncoding('utf-8');
var bufs;
res.on('data', function (buf) {
bufs = (!bufs)
? bufs = buf
: bufs += buf;
});
res.on('end', function () {
var data = bufs.toString();
console.log(data.length);
console.log(data);
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment