How to use @cloudant/couchbackup - 2 common examples

To help you get started, we’ve selected a few @cloudant/couchbackup examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cloudant / couchbackup / examples / s3-backup-stream.js View on Github external
s3Client.upload(params, function(err, data) {
      debug('Object store upload done');
      if (err) {
        debug(err);
        reject(new VError(err, 'Object store upload failed'));
        return;
      }
      debug('Object store upload succeeded');
      debug(data);
      resolve();
    }).httpUploadProgress = (progress) => {
      debug(`Object store upload progress: ${progress}`);
    };

    debug(`Starting streaming data from ${s(sourceUrl)}`);
    couchbackup.backup(
      sourceUrl,
      streamToUpload,
      (err, obj) => {
        if (err) {
          debug(err);
          reject(new VError(err, 'CouchBackup failed with an error'));
          return;
        }
        debug(`Download from ${s(sourceUrl)} complete.`);
        streamToUpload.end(); // must call end() to complete upload.
        // resolve() is called by the upload
      }
    );
  });
}
github cloudant / couchbackup / examples / s3-backup-file.js View on Github external
return new Promise((resolve, reject) => {
    couchbackup.backup(
      sourceUrl,
      fs.createWriteStream(backupTmpFilePath),
      (err) => {
        if (err) {
          return reject(new VError(err, 'CouchBackup process failed'));
        }
        debug('couchbackup to file done; uploading to S3');
        resolve('creating backup file complete');
      }
    );
  });
}

@cloudant/couchbackup

CouchBackup - command-line backup utility for Cloudant/CouchDB

Apache-2.0
Latest version published 1 month ago

Package Health Score

81 / 100
Full package analysis

Popular @cloudant/couchbackup functions