I always forgot to enable the flow mode of node streams,
flower
should help me to deal with that.
npm i @maboiteaspam/flower --save
flower
is a stream object in flow mode,
.resume()
is always called.
var flower = require('@maboiteaspam/flower')
process.stdin.pipe(flower(fnTransform, fnFlush));
I have to call for .resume()
on each and every stream i create.
var streamA = through2.obj(function (req, enc, cb) {
cb(null, req);
})
streamA.pipe(through2.obj().resume())
.pipe(through2.obj().resume())
.pipe(through2.obj().resume())
.pipe(through2.obj().resume())
.pipe(through2.obj().resume());
for (var e=...) {
streamA.write(...);
}
streamA.resume();
With flower
i want to ease that...
var streamA = flower();
streamA
.pipe(flower())
.pipe(flower())
.pipe(flower())
.pipe(flower())
.pipe(flower());
for (var e=...) {
streamA.write(...);
}