Skip to content

Instantly share code, notes, and snippets.

@davidbanham
Created July 4, 2013 12:29
Show Gist options
  • Save davidbanham/5927279 to your computer and use it in GitHub Desktop.
Save davidbanham/5927279 to your computer and use it in GitHub Desktop.
Aggregate a stream
var http = require('http');
opts = {
domain: 'google.com'
}
http.get(opts, function(res) {
response = ''
res.on('data', function(data) {
response += data.toString()
}
res.on('end', function() {
console.log("the whole response was", response);
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment