Skip to content

maboiteaspam/flower

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

flower

I always forgot to enable the flow mode of node streams, flower should help me to deal with that.

install

npm i @maboiteaspam/flower --save

Usage

flower is a stream object in flow mode, .resume() is always called.

var flower = require('@maboiteaspam/flower')

process.stdin.pipe(flower(fnTransform, fnFlush));

My problem with through2

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(...);
}

Read more

About

flower is a stream object in flow mode.

Resources

Stars

Watchers

Forks

Packages

No packages published