stream-splice
Compose multi-step streams into a single pipeline segment.
E.g. your transform module is actually two consecutive transform operations, but you want it exposed as a single "stream.Transform" object.
// In your modulemoduleexports = txvar filter = var map = var splice = { var noBs = var uc = var zz = return } // Using your module:var tx = source // That is equivalent to:source // A less contrived example:// catLines is equivalent to fs.createReadStream except stream chunks// will be the lines of the filemoduleexports = catLines var fs = var split = var map = var splice = { var rs = fs var reAddNewline = return }
API
splice(stream1 [,stream2] [,...streamN])
Creates a pipeline that can be piped into/out of which is composed of all of the spliced streams piped together.
E.g.
source // is roughly equivalent to source
Error Handling:
Just like pipe
, splice
does NOT attempt to do error forwarding. Sure, it could do something where all the errors in the pipeline are forwarded onto the topmost stream, however this would create a hidden requirement of code organization where your error handlers would have to be above the splice
call to avoid double-handled errors.
So do this:
abc source
This will let you keep the maximum flexibility with your error handling.
LICENSE
MIT