code: function backupToS3(sourceUrl, s3Client, s3Bucket, s3Key, shallow) {
    return new Promise((resolve, reject) => {
      debug(`Setting up S3 upload to ${s3Bucket}/${s3Key}`);
  
      // A pass through stream that has couchbackup's output
      // written to it and it then read by the S3 upload client.
      // It has a 64MB highwater mark to allow for fairly
      // uneven network connectivity.
      const streamToUpload = new stream.PassThrough({ highWaterMark: 67108864 });
  
      // Set up S3 upload.
      const params = {
        Bucket: s3Bucket,
        Key: s3Key,
        Body: streamToUpload
      };
      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
        }
      );
    });
  }
docs: Backup directly from Cloudant to an object store object via a stream.
  
  @param {any} sourceUrl URL of database
  @param {any} s3Client Object store client
  @param {any} s3Bucket Backup destination bucket
  @param {any} s3Key Backup destination key name (shouldn't exist)
  @param {any} shallow Whether to use the couchbackup `shallow` mode
  @returns Promise