https://github.com/pouchdb/pouchdb-size
Adds disk_size to info()'s output for your leveldown backed PouchDB's.
https://github.com/pouchdb/pouchdb-size
Last synced: 9 months ago
JSON representation
Adds disk_size to info()'s output for your leveldown backed PouchDB's.
- Host: GitHub
- URL: https://github.com/pouchdb/pouchdb-size
- Owner: pouchdb
- Created: 2014-12-05T11:53:21.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2017-03-07T08:27:04.000Z (over 9 years ago)
- Last Synced: 2025-08-21T05:42:32.373Z (10 months ago)
- Language: JavaScript
- Size: 14.6 KB
- Stars: 5
- Watchers: 5
- Forks: 8
- Open Issues: 22
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
pouchdb-size
============
[](https://travis-ci.org/marten-de-vries/pouchdb-size)
[](https://david-dm.org/marten-de-vries/pouchdb-size)
[](https://david-dm.org/marten-de-vries/pouchdb-size#info=devDependencies)
Adds disk_size to info()'s output for your *down backed PouchDB's.
Tested with leveldown, sqldown, jsondown, locket and medeadown. When it
can't determine the database size, it falls back to the default
``info()`` output.
Example
-------
```bash
npm install pouchdb pouchdb-size
```
```javascript
//index.js
var PouchDB = require('pouchdb');
PouchDB.plugin(require('pouchdb-size'));
var db = new PouchDB('test');
db.installSizeWrapper();
db.info().then(function (resp) {
//resp will contain disk_size
})
```
API
---
- ``db.installSizeWrapper()``
wraps ``db.info()`` in such a way that it will include a ``disk_size``
property in its output for supported database backends.
- ``db.getDiskSize([callback])``
like PouchDB, this method both returns a Promise and accepts a
callback. Either returns an error or the disk size of the current db.