# pouchdb-all-dbs

> PouchDB allDbs plugin

Latest version **1.1.1** (published 2021-02-19) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install pouchdb-all-dbs
pnpm add pouchdb-all-dbs
yarn add pouchdb-all-dbs
bun add pouchdb-all-dbs
```

## 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 | 1.1.1 |
| Published | 2021-02-19 |
| First published | 2014-06-01 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 52 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 29 |
| Maintainers | nolanlawson, commandoline, openscript |
| Keywords | pouch, pouchdb, plugin, allDbs, couch, couchdb |

## Links

- npm: https://www.npmjs.com/package/pouchdb-all-dbs
- Repository: https://github.com/nolanlawson/pouchdb-all-dbs
- Homepage: https://github.com/nolanlawson/pouchdb-all-dbs#readme
- Issues: https://github.com/nolanlawson/pouchdb-all-dbs/issues
- npm.io page: https://npm.io/package/pouchdb-all-dbs

## Dependencies (5)

- [es3ify](https://npm.io/package/es3ify.md) ^0.2.2
- [inherits](https://npm.io/package/inherits.md) ~2.0.1
- [argsarray](https://npm.io/package/argsarray.md) 0.0.1
- [tiny-queue](https://npm.io/package/tiny-queue.md) ^0.2.0
- [pouchdb-promise](https://npm.io/package/pouchdb-promise.md) 6.4.3

## Recent versions

- 1.1.1 (latest) — 2021-02-19
- 1.1.0 — 2021-02-17
- 1.0.2 — 2016-06-16
- 1.0.1 — 2014-12-12
- 1.0.0 — 2014-12-07
- 0.1.6 — 2014-08-13
- 0.1.5 — 2014-07-06
- 0.1.4 — 2014-07-05
- 0.1.3 — 2014-07-03
- 0.1.2 — 2014-06-09
- 0.1.1 — 2014-06-09
- 0.1.0 — 2014-06-01

## README

PouchDB allDbs() plugin
=====

[![Build Status](https://travis-ci.org/nolanlawson/pouchdb-all-dbs.svg)](https://travis-ci.org/nolanlawson/pouchdb-all-dbs)

This plugin exposes the `PouchDB.allDbs()` function, which you can use to list all local databases. It works by listening for `PouchDB.on('created')` and `PouchDB.on('destroyed')` events, and maintaining a separate database to store the names of those databases.

**Note**: `allDbs()` used to be part of PouchDB core (enabled using `PouchDB.enableAllDbs = true`). It was deprecated in PouchDB 2.0.0, and now lives on as a plugin.

Usage
-----

### In the browser

To use this plugin, include it after `pouchdb.js` in your HTML page:

```html
<script src="pouchdb.js"></script>
<script src="pouchdb.all-dbs.js"></script>
```

This plugin is also available from Bower:

```
bower install pouchdb-all-dbs
```

Merely including it as a script tag will work, assuming you also used a script tag for PouchDB.

### In Node/Browserify/Webpack/etc.

First, npm install it:

```
npm install pouchdb-all-dbs
```

And then do this:

```js
var PouchDB = require('pouchdb');
require('pouchdb-all-dbs')(PouchDB);
```

API
-----

#### PouchDB.allDbs([callback])

Returns a list of all non-deleted databases.  Example usage as a promise:

```js
PouchDB.allDbs().then(function (dbs) {
  // dbs is an array of strings, e.g. ['mydb1', 'mydb2']
}).catch(function (err) {
  // handle err
});
```

Or if you like callbacks, you can use that style instead:

```js
PouchDB.allDbs(function (err, dbs) {
  if (err) {
    // handle err
  }
  // dbs is an array of strings, e.g. ['mydb1', 'mydb2']
});
```

#### PouchDB.resetAllDbs([callback])

Destroys the separate allDbs database.  You should never need to call this function; I just use it for the unit tests.

Example usage:

```js
PouchDB.resetAllDbs().then(function () {
  // allDbs store is now destroyed
}).catch(function (err) {
  // handle err
});
```

Building
----
    npm install
    npm run build

Testing
----

### In Node

This will run the tests in Node using LevelDB:

    npm test
    
You can also check for 100% code coverage using:

    npm run coverage


If you have mocha installed globally you can run single test with:
```
TEST_DB=local mocha --reporter spec --grep search_phrase
```

The `TEST_DB` environment variable specifies the database that PouchDB should use (see `package.json`).

### In the browser

Run `npm run dev` and then point your favorite browser to [http://127.0.0.1:8001/test/index.html](http://127.0.0.1:8001/test/index.html).

The query param `?grep=mysearch` will search for tests matching `mysearch`.

### Automated browser tests

You can run e.g.

    CLIENT=selenium:firefox npm test
    CLIENT=selenium:phantomjs npm test

This will run the tests automatically and the process will exit with a 0 or a 1 when it's done. Firefox uses IndexedDB, and PhantomJS uses WebSQL.

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