changes-stream
A fault tolerant changes stream with builtin retry HEAVILY inspired by
follow
. This module is a Readable
Stream with all of
the fun stream methods that you would expect.
install
npm install changes-stream --save
Options
So changes-stream
can take a fair bit of options in order so that you can
fully customize your _changes
request. They include the following:
{
db: 'http://localhost:5984/my_db',
feed: 'continuous',
filter: 'docs/whatever',
inactivity_ms: 60 * 60 * 1000,
timeout: undefined,
requestTimeout: 2 * 60 * 1000,
agent: undefined,
since: 0,
heartbeat: 30 * 1000,
style: 'main_only',
include_docs: false,
query_params: {},
use_post: false
}
Example
const ChangesStream = require('changes-stream');
const changes = new ChangesStream('http://localhost:5984/my_database');
changes.on('readable', () => {
const change = changes.read();
});