pouch-stream

0.4.1 • Public • Published

Pouch Stream

Streaming plugin for PouchDB

npm install pouch-stream
PouchDB.plugin(require('pouch-stream'));

Writable

note: the docs you give it can have _ids's or not and it will do post or put depending, you can also pass an array for bulk docs, it also takes an option object which will be passed verbatem to bulkDocs, put, or post.

var stream = db.createWriteStream();
stream.write({
  foo: 'bar',
  _id: 'testDoc'
}, function () {
  // chunk is flushed
});

but wait there is more, the database itself is a write streem though you can't close it, you can do

var random = require("random-document-stream");
random(100).pipe(db);

Readable

var db = new PouchDB('foo');
var stream = db.createReadStream();
stream.on('data', function (d) {
  // deal with data
});

you can also set since

var stream = db.createReadStream({since:19}); stream.on('data', function (d) { // deal with data after seq 19 });

Readme

Keywords

Package Sidebar

Install

npm i pouch-stream

Weekly Downloads

1,640

Version

0.4.1

License

MIT

Last publish

Collaborators

  • cwmma