Concatenate a readable stream's data into a single array
Concatenate a readable stream's data into a single array.
You may also be interested in:
- raw-body for strings
var toArray = require'stream-to-array'
Returns all the data objects in an array. This is useful for streams in object mode if you want to just use an array.
var stream =toArraystreamassertokArrayisArrayarr
stream is not defined, it is assumed that
this is a stream.
var stream =streamtoArray = toArraystreamtoArray
callback is not defined, then it is assumed that it is being yielded within a generator.
var stream =streamtoArray = toArrayvar arr = yield streamtoArray
If you want to return a buffer, just use
var stream =var arr = yield toArraystreamvar buffer = Bufferconcatarr