UNPKG

superagent

Version:

elegant & feature rich browser / node HTTP with a fluent API

10 lines (9 loc) 229 B
module.exports = function(res, fn){ var data = []; // Binary data needs binary storage res.on('data', function(chunk){ data.push(chunk); }); res.on('end', function () { fn(null, Buffer.concat(data)); }); };