1.1.6 • Published 4 years ago

couchdb-backup-restore v1.1.6

Weekly downloads
67
License
MIT
Repository
github
Last release
4 years ago

couchdb-backup-restore NPM version Build Status Dependency Status

Creates backups of couchdb databases (.tar.gz files containing one .json file per database) and restores from those backups.

Also plays nice with Cloudant (hosted CouchDB service).

Limitations

Install

$ npm install --save couchdb-backup-restore

Usage

var cbr = require('couchdb-backup-restore');

var config = {credentials: 'http://localhost:5984'};

function done(err) {
  if (err) {
    return console.error(err);
  }
  console.log('all done!');
}

// backup
cbr.backup(config, done).pipe(fs.createWriteStream('./db-backup.tar.gz'))
  
// restore
fs.createReadStream('./db-backup.tar.gz').pipe(cbr.restore(config, done));

Bluemix / Cloudant example:

var cbr = require('couchdb-backup-restore');
var bluemix = require('bluemix'); 

var config = {
 credentials: bluemix.getService('cloudantNoSQLDB').credentials
}

// or just var config = bluemix.getService('cloudantNoSQLDB');

Configuring

Default options are:

{
  credentials: 'http://localhost:5984',
  excludeDbs: ['_replicator', '_users'], // automatic built-in dbs that you probably don't want to backup
  databases: null
}
  • credentials is passed directly to nano and can be either a straight url or a configuration object.
  • excludeDbs should be an array, although it may be an empty array ([]) if you want to include the built-in _replicator and _users databases.
  • databases may be an array. If set, CBR will only back up the specified DBs, overriding the excludeDbs option.

License

MIT © Nathan Friedly

1.1.6

4 years ago

1.1.5

9 years ago

1.1.4

9 years ago

1.1.3

9 years ago

1.1.1

9 years ago

1.1.0

9 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago