1.2.1 • Published 8 years ago

collect-stream v1.2.1

Weekly downloads
5,069
License
MIT
Repository
github
Last release
8 years ago

collect-stream

Collect a readable stream's output and errors.

build status

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-stream

License

MIT

1.2.1

8 years ago

1.2.0

8 years ago

1.1.1

9 years ago

1.1.0

9 years ago

1.0.0

10 years ago

0.0.0

10 years ago