Batch Object Write Stream
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
tests
.gitignore
.travis.yml
README.md
index.js
package.json

README.md

batch-write-stream

Write stream that batches all writes done in the same tick.

Build Status

Install

$ npm install batch-write-stream --save

Use

Require

var BatchWriteStream = require('batch-write-stream');

Create

var stream = BatchWriteStream();

Or, with options:

var options = {
  highWaterMark: 100000,  // default
  maxConcurrentBatches: 1 // default
};

var stream = BatchWriteStream(options);

Implement _writeBatch

stream._writeBatch = function(batch, cb) {
  // batch is an array
  // call cb when done
}

Map

You can map each value before it is written:

stream._map = function(d) {
  return transform(d);
};

License

MIT