PouchDB-Orbit
An OrbitDB plugin for PouchDB that adds some methods for P2P replication:
const PouchDB = PouchDB // ... once you have an orbit instance ... const db = dbNamedb
You can also pre-load from a certain hash:
// ... using the hash from above ...db
Install
Install with npm:
npm i pouchdb-orbit
Then, in your code, register it with PouchDB as a plugin like this:
const PouchDB = PouchDB
Usage
The plugin adds some methods and properties to each PouchDB instance:
.load(orbit, [address]) -> Promise
Creates an OrbitDB store and registers event listeners with it and the PouchDB changes feed in order to both stores synchronized with each other. Returns a promise that resolves once the the OrbitDB store is ready for querying.
.merge(address)
Retrieves entries from the given OrbitDB address and merges them locally, adding them to PouchDB. Returns a promise that resolves once all the documents have been processed.
.address
Getter for the OrbitDB address ({ root, path }
) for this database.
.key
Getter for the keypair for this OrbitDB instance.