streamz: A swiss-army-knife of a Stream2 stream.


GitHub – ZJONSSON/streamz: A swiss-army-knife of a Stream2 stream.

The native stream.Transform does not provide concurrent operations out of the box or multiple incoming pipes going into a single transform. Streamz is a lightweight wrapper around the Transform stream:

Executes custom functions (i.e. writes, transforms, filters, pushes) concurrently up to a user defined cap.
Tracks outstanding asynchronous functions by waiting for callbacks or resolved promises
Keeps count of incoming pipes as they are initiated and reduces count when they end
Issues ‘end’ only when all incoming pipes have ended
Issues ‘finish’ only when all incoming pipes have ended and any concurrent functions have finished
Provides downstream pipes in all instances. If nothing is “pushed”, the downstream pipe will only receive the end event (at the right time).
Passes errors down to the first listener in the chain
Provides an easy transition to final promise that is resolved on finish and rejected on error

Related Posts