writable-stream-parallel
Extension of the new node.js Writable stream interface that allows for parallel writes.
Installation
npm install writable-stream-parallel
Currently only works with node v0.9.{11,12} and v0.10.x.
Motivation
The normal node Writable stream can only perform one write at a time. For example:
var Readable = Readable;var Writable = Writable var r = objectMode: true ;r {}r;r;r; var writable = objectMode: true;writable { console; ;};r;
Output:
writing 1
wrote 1
writing 2
wrote 2
writing 3
wrote 3
stream-writable-parallel behavior
Serial writes limit the usefulness of streams in a lot of settings. stream-writable-parallel
provides a Writable class that parallelizes calls to _write
up to a certain maxWrites
:
var Writable = Writable; var writable = objectMode: true maxWrites: 10;writable { console; ;};r;
Output:
writing 1
writing 2
writing 3
wrote 1
wrote 2
wrote 3