开发者社区> 镜像站> NPM> pouch-stream
pouch-stream
Experimental streaming version of PouchDB
Last updated 6 years ago by cwmma .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install pouch-stream 
SYNC missed versions from official npm registry.

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 });

Current Tags

  • 0.4.1                                ...           latest (6 years ago)

6 Versions

  • 0.4.1                                ...           6 years ago
  • 0.4.0                                ...           6 years ago
  • 0.3.1                                ...           6 years ago
  • 0.3.0                                ...           7 years ago
  • 0.2.0                                ...           7 years ago
  • 0.1.1                                ...           7 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 8
Dependencies (2)
Dev Dependencies (5)