parallel-write-stream
Parallel Write Stream is an abstract class which helps create kind of passthrough stream.
Your have to implement _save
method and operate with the object streams only.
Regardless of how data will flow into your writable stream, the batch of tasks will be processed in parallel.
Install
$ npm install --save parallel-write-stream
Usage
To implement parallel write stream, follow the pattern:
var util = ;var ParallelWriteStream = ; var { ParallelWriteStream;};util; Updaterprototype { // implement procedure to save doc here // invoke callback then save will be done ;};
The size of the batch is specified in the options passed to constructor.
var update = concurrency: 5;
API
_save(doc, callback)
doc
The document you want to store, update or process in other way.
callback(err)
A function which is called when the processing is finished. First argument is the error.
License
MIT © 2015 Vladimir Kuznetsov