# changes-stream

> Simple module that handles getting changes from couchdb

Latest version **2.2.0** (published 2016-11-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install changes-stream
pnpm add changes-stream
yarn add changes-stream
bun add changes-stream
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.2.0 |
| Published | 2016-11-30 |
| First published | 2014-04-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 56 |
| Author | Jarrett Cruger |
| Maintainers | jcrugzz, mmalecki |
| Keywords | changes, couchdb, follow |

## Links

- npm: https://www.npmjs.com/package/changes-stream
- Repository: https://github.com/jcrugzz/changes-stream
- Issues: https://github.com/jcrugzz/changes-stream/issues
- npm.io page: https://npm.io/package/changes-stream

## Dependencies (4)

- [back](https://npm.io/package/back.md) ~0.1.5
- [debug](https://npm.io/package/debug.md) ~0.8.0
- [http-https](https://npm.io/package/http-https.md) ~1.0.0
- [readable-stream](https://npm.io/package/readable-stream.md) 1.0.x

## Recent versions

- 2.2.0 (latest) — 2016-11-30
- 2.1.0 — 2016-09-06
- 2.0.0 — 2016-08-16
- 1.1.0 — 2015-11-19
- 1.0.9 — 2015-11-06
- 1.0.8 — 2015-08-27
- 1.0.7 — 2015-08-10
- 1.0.6 — 2015-07-28
- 1.0.5 — 2014-05-21
- 1.0.4 — 2014-05-21
- 1.0.3 — 2014-04-29
- 1.0.2 — 2014-04-25
- 1.0.1 — 2014-04-19
- 1.0.0 — 2014-04-19
- 0.1.1 — 2014-04-18

## README

# changes-stream

[![build status](https://secure.travis-ci.org/jcrugzz/changes-stream.png)](http://travis-ci.org/jcrugzz/changes-stream)

A fault tolerant changes stream with builtin retry HEAVILY inspired by
[`follow`][follow]. This module is a [`Readable` Stream][readable] with all of
the fun stream methods that you would expect.

## install

```sh
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:

```js
{
  db: 'http://localhost:5984/my_db', // full database URL
  feed: 'continuous', // Can also be longpoll technically but not currently implemented
  filter: 'docs/whatever', // Can be a defined couchdb view, a local filter function or an array of IDs
  inactivity_ms: 60 * 60 * 1000, // time allow inactivity before retrying request
  timeout: undefined, // How long couchdb should wait for a change to show up before closing the feed. in milliseconds
  requestTimeout: 2 * 60 * 1000, // http timeout
  agent: undefined, // http agent
  since: 0, // update sequence to start from, 'now' will start it from latest
  heartbeat: 30 * 1000, // how often we want couchdb to send us a heartbeat message
  style: 'main_only', // specifies how many revisions returned all_docs would return leaf revs
  include_docs: false, // whether or not we want to return the full document as a property
  query_params: {}, // custom arbitrary params to send in request e.g. { hello: 'world' }
  use_post: false // switch the default HTTP method to POST (cannot be used with a filter array)
}
```

## Example

```js
var ChangesStream = require('changes-stream');

var changes = new ChangesStream('http://localhost:5984/my_database');

changes.on('readable', function () {
  var change = changes.read();
});

```
[follow]: https://github.com/iriscouch/follow
[readable]: http://nodejs.org/api/stream.html#stream_class_stream_readable

---
_Source: https://npm.io/package/changes-stream · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
