How to use the gcs-resumable-upload.upload function in gcs-resumable-upload

To help you get started, we’ve selected a few gcs-resumable-upload 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 googleapis / gcs-resumable-upload / samples / quickstart.js View on Github external
return new Promise((resolve, reject) => {
    fs.createReadStream(file)
      .pipe(upload({ bucket, file }))
      .on('progress', (progress) => {
        console.log('Progress event:')
        console.log('\t bytes: ', progress.bytesWritten);
        const pct = Math.round(progress.bytesWritten/fileSize*100);
        console.log(`\t ${pct}%`)
      })
      .on('finish', () => {
        console.log('Upload complete!');
        resolve();
      })
      .on('error', (err) => {
        console.error('There was a problem uploading the file :(');
        reject(err);
      })
    });
}
github googleapis / nodejs-storage / src / file.js View on Github external
startResumableUpload_(dup, options) {
    options = extend(
      {
        metadata: {},
      },
      options
    );

    const uploadStream = resumableUpload.upload({
      authClient: this.storage.authClient,
      bucket: this.bucket.name,
      file: this.name,
      generation: this.generation,
      key: this.encryptionKey,
      kmsKeyName: this.kmsKeyName,
      metadata: options.metadata,
      offset: options.offset,
      predefinedAcl: options.predefinedAcl,
      private: options.private,
      public: options.public,
      uri: options.uri,
      userProject: options.userProject,
    });

    uploadStream

gcs-resumable-upload

Upload a file to Google Cloud Storage with built-in resumable behavior

MIT
Latest version published 1 year ago

Package Health Score

61 / 100
Full package analysis

Popular gcs-resumable-upload functions