nouveau-theatre-de-besancon/node_modules/collect-stream
2024-09-20 10:32:49 +02:00
..
.npmignore install gulp to process code 2024-09-20 10:32:49 +02:00
.travis.yml install gulp to process code 2024-09-20 10:32:49 +02:00
build.js install gulp to process code 2024-09-20 10:32:49 +02:00
History.md install gulp to process code 2024-09-20 10:32:49 +02:00
index.js install gulp to process code 2024-09-20 10:32:49 +02:00
Makefile install gulp to process code 2024-09-20 10:32:49 +02:00
package.json install gulp to process code 2024-09-20 10:32:49 +02:00
README.md install gulp to process code 2024-09-20 10:32:49 +02:00
test.js install gulp to process code 2024-09-20 10:32:49 +02:00

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