UNPKG

superagent

Version:

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

13 lines (10 loc) 227 B
'use strict'; module.exports = (res, fn) => { const data = []; // Binary data needs binary storage res.on('data', chunk => { data.push(chunk); }); res.on('end', () => { fn(null, Buffer.concat(data)); }); };