through2-parallel
Creates a through stream (Transform stream) which executes in parallel while maintaining the order of the emitted chunks.
Stability: Experimental
Usage
var throughParallel = ; var stream = throughParallel; stream; stream;stream;stream;stream;
The code above will print (default concurrency is 2):
Started 1
Started 2
Completed 2
Completed 1
Emitted: 1
Emitted: 2
Started 3
Completed 3
Emitted: 3
API
throughParallel([options], [transform], [flush])
options
: Options to pass to theTransform
stream plus one specific option:concurrency
: defaults to2
and specifies how many tasks can run in parallel
transform
: the_transform
function.flush
: the_flush
function.
throughParallel.obj([options], [transform], [flush])
A syntactic sugar for throughParallel({objectMode: true}, ...)
.