Consume a stream of data into a binary Buffer as efficiently as possible.
npm install fast-stream-to-buffer --save
Process an abitrary readable stream:
const streamToBuffer =
Or use the
onStream() helper function:
const http =const streamToBuffer =// `http.get` expects a callback as the 2nd argument that will be called// with a readable stream of the responsehttp
stream- Any readable stream
callback- A callback function which will be called with an optional error object as the first argument and a buffer containing the content of the
streamas the 2nd
fn = streamToBuffer.onStream(callback)
Returns a function
fn which expects a readable stream as its only
argument. When called, it will automatically call
with the stream as the first argument and the
callback as the second.