# pouch-stream-multi-sync

> Sync several PouchDBs through a stream.

Latest version **0.3.0** (published 2016-05-31) · ISC license · 0 weekly downloads

## Install

```sh
npm install pouch-stream-multi-sync
pnpm add pouch-stream-multi-sync
yarn add pouch-stream-multi-sync
bun add pouch-stream-multi-sync
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.0 |
| Published | 2016-05-31 |
| First published | 2015-11-24 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | pgte |
| Maintainers | pgte |

## Links

- npm: https://www.npmjs.com/package/pouch-stream-multi-sync
- Repository: https://github.com/pgte/pouch-stream-multi-sync
- Homepage: https://github.com/pgte/pouch-stream-multi-sync#readme
- Issues: https://github.com/pgte/pouch-stream-multi-sync/issues
- npm.io page: https://npm.io/package/pouch-stream-multi-sync

## Dependencies (6)

- [debug](https://npm.io/package/debug.md) ^2.2.0
- [xtend](https://npm.io/package/xtend.md) ^4.0.1
- [pipe-channels](https://npm.io/package/pipe-channels.md) ^0.1.1
- [reconnect-core](https://npm.io/package/reconnect-core.md) ^1.1.0
- [pouch-remote-stream](https://npm.io/package/pouch-remote-stream.md) ^0.3.0
- [pouch-stream-server](https://npm.io/package/pouch-stream-server.md) ^0.2.1

## Recent versions

- 0.3.0 (latest) — 2016-05-31
- 0.2.1 — 2015-11-30
- 0.2.0 — 2015-11-26
- 0.1.2 — 2015-11-25
- 0.1.1 — 2015-11-25
- 0.1.0 — 2015-11-24

## README

# pouch-stream-multi-sync

[![By](https://img.shields.io/badge/made%20by-yld!-32bbee.svg?style=flat)](http://yld.io/contact?source=github-pouch-stream-multi-sync)
[![Build Status](https://secure.travis-ci.org/pgte/pouch-stream-multi-sync.svg?branch=master)](http://travis-ci.org/pgte/pouch-stream-multi-sync?branch=master)

Sync several PouchDBs through a stream.

Supports reconnection, negotiation and authentication.

## Install

```
$ npm install pouch-stream-multi-sync --save
```

## Server

```js
var PouchSync = require('pouch-stream-multi-sync');

var server = PouchSync.createServer(onRequest);

function onRequest(credentials, dbName, cb) {
  if (credentials.token == 'some token') {
    cb(null, new PouchDB(dbName));
  } else {
    cb(new Error('not allowed'));
  }
};

// pipe server into and from duplex stream

stream.pipe(server).pipe(stream);
```

## Client

Example of client using a websocket:

```js
var websocket = require('websocket-stream');
var PouchSync = require('pouch-stream-multi-sync');

var db = new PouchDB('todos');
var client = PouchSync.createClient(getStream);
var sync = client.sync(db, {
  remoteName: 'todos-server',
  credentials: { token: 'some token'}
});

client.connect('ws://somehost:someport');

function getStream(address) {
  return websocket(address);
}
```

## API

TODO


## License

ISC

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