sensordb2 e64a8defe5 3.17 | 1 год назад | |
---|---|---|
.. | ||
LICENSE | 1 год назад | |
README.md | 1 год назад | |
index.js | 1 год назад | |
package.json | 1 год назад |
Wrap a ReadableStream in a TransformStream.
var from = require('from2');
var concat = require('concat-stream');
var toThrough = require('to-through');
var readable = from([' ', 'hello', ' ', 'world']);
// Can be used as a Readable or Transform
var maybeTransform = toThrough(readable);
from(['hi', ' ', 'there', ','])
.pipe(maybeTransform)
.pipe(concat(function(result) {
// result.toString() === 'hi there, hello world'
}));
toThrough(readableStream)
Takes a readableStream
as the only argument and returns a through2
stream. If the returned stream is piped before nextTick
, the wrapped readableStream
will not flow until the upstream is flushed. If the stream is not piped before nextTick
, it is ended and flushed (acting as a proper readable).
MIT