sfcode
An Online Competing and Development Environment
|
A Minipass stream that collects all the data into a single chunk
Note that this buffers ALL data written to it, so it's only good for situations where you are sure the entire stream fits in memory.
Note: this is primarily useful for the Collect.PassThrough
class, since Minipass streams already have a .collect()
method which returns a promise that resolves to the array of chunks, and a .concat()
method that returns the data concatenated into a single Buffer or String.
If you want to collect the data, but also act as a passthrough stream, then use Collect.PassThrough
instead (for example to memoize streaming responses), and listen on the collect
event.
All minipass options are supported.