parallel-stream
A transform stream that processes chunks concurrently. Stream order is not preserved.
Example usage
var Parallel = require('parallel-stream');
var util = require('util');
var fs = require('fs');
util.inherits(MyStream, Parallel);
function MyStream(concurrency, options) {
Parallel.call(this, concurrency, options);
}
MyStream.prototype._process = function(chunk, enc, callback) {
var _this = this;
processChunkAsync(chunk, function(err, result) {
if (err) return callback(err);
_this.push(result);
callback();
});
}
var myStream = new MyStream(10);
fs.createReadStream('/some/file')
.pipe(myStream)
.pipe(process.stdout);