Package Exports
- collect-stream
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (collect-stream) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
collect-stream
Collect a readable stream's output and errors.
Usage
Give it a readable stream and a function and it will call latter with the potential error and a smart representation of the data the stream emitted.
import collect from 'collect-stream';
collect(stringStream, (err, data) => {
console.log(data); // one string
});
collect(bufferStream, (err, data) => {
console.log(data); // one buffer
});
collect(objectStream, (err, data) => {
console.log(data); // an array of objects
});Give it options and it will pass them to concat-stream.
import collect from 'collect-stream';
collect(someStream, {
encoding: 'object'
}, (err, data) => {
console.log(data) // forced to be an array of objects
});Installation
$ npm install collect-streamLicense
MIT
