merge2
Merge multiple streams into one stream in sequence or parallel.
Install
Install with npm
Usage
API
merge2()
merge2(options)
merge2(stream1, stream2, ..., streamN)
merge2(stream1, stream2, ..., streamN, options)
merge2(stream1, [stream2, stream3, ...], streamN, options)
return a duplex stream (mergedStream). streams in array will be merged in parallel.
mergedStream.add(stream)
mergedStream.add(stream1, [stream2, stream3, ...], ...)
return the mergedStream.
mergedStream.on('queueDrain', function() {})
It will emit 'queueDrain' when all streams merged. If you set end === false
in options, this event give you a notice that should add more streams to merge or end the mergedStream.
stream
option Type: Readable
or Duplex
or Transform
stream.
options
option Type: Object
.
end -
Boolean
- ifend === false
then mergedStream will not be auto ended, you should end by yourself. Default:undefined
pipeError -
Boolean
- ifpipeError === true
then mergedStream will emiterror
event from source streams. Default:undefined
objectMode -
Boolean
. Default:true
objectMode
and other options(highWaterMark
, defaultEncoding
...) is same as Node.js Stream
.
License
MIT © Teambition
Last updated