Registry / storage / gcs-browser-upload

gcs-browser-upload

JSON →
library2.0.0jsnpmunverified

Client-side library for resumable, chunked uploads to Google Cloud Storage directly from the browser. v2.0.0 supports pausing and resuming uploads across page reloads by storing chunk checksums in localStorage. Uses the GCS resumable upload protocol. Requires regenerator-runtime. Not actively maintained, but stable for browser-to-GCS uploads without a server proxy.

npm install gcs-browser-upload
INSTALL
IMPORT
SIG · GCS-BROWSER-UPLOAD
G
gcs-browser-upload
storagejavascriptv2.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Upload
import Upload from 'gcs-browser-upload'
import { Upload } from 'gcs-browser-upload'
Default export only; named export is not available.
Upload
const Upload = require('gcs-browser-upload').default
const Upload = require('gcs-browser-upload')
CJS require does not resolve default export automatically; use .default.
Upload
import Upload from 'gcs-browser-upload'
const Upload = require('gcs-browser-upload')
CommonJS mistake: missing .default when using require() with ESM default exports.

Creates a new Upload instance, listens to chunk progress, and logs completion or errors.

import Upload from 'gcs-browser-upload'; import regeneratorRuntime from 'regenerator-runtime'; const fileInput = document.getElementById('fileInput'); fileInput.addEventListener('change', async () => { const upload = new Upload({ id: 'my-upload', url: process.env.GCS_RESUMABLE_URL ?? '', file: fileInput.files[0], onChunkUpload: (info) => { console.log('Progress:', info); } }); try { await upload.start(); console.log('Upload complete!'); } catch (err) { console.error('Upload failed', err); } });
Debug
Known issues
breakingVersion 2.x changed the API: constructor now takes a config object instead of separate arguments.
fix
Upgrade to new config object format: new Upload({ id, url, file, ... })
affects: >=2.0.0
gotchaRequires globally available regeneratorRuntime for async/await. Not included in bundle.
fix
Install regenerator-runtime and import it before using gcs-browser-upload: import 'regenerator-runtime/runtime';
affects: >=1.0.0
deprecatedPackage is no longer actively maintained; no updates since 2019.
fix
Consider migrating to a maintained library like tus-js-client or uppy.
affects: >=2.0.0
gotchaThe storage option defaults to window.localStorage, which may throw in some browsers (e.g., private mode) or exceed quota.
fix
Wrap localStorage access in try/catch or provide a polyfill/shim.
affects: >=1.0.0
gotchachunkSize must be a multiple of 262144 (256 KiB). API does not validate; incorrect values cause failed uploads.
fix
Always set chunkSize to a multiple of 262144 (e.g., 262144, 524288, 1048576).
affects: >=1.0.0
Errors
Common errors & fixes
Uncaught ReferenceError: regeneratorRuntime is not defined
Missing regenerator-runtime polyfill for async functions.
fix
Install and import regenerator-runtime before using gcs-browser-upload: require('regenerator-runtime/runtime');
TypeError: Failed to construct 'Upload': Please use the 'new' operator
Using Upload() without new or incorrect export destructuring.
fix
Use: const upload = new Upload({...});
TypeError: upload.start is not a function
Using require('gcs-browser-upload') directly without .default.
fix
Use const Upload = require('gcs-browser-upload').default;
Upgrade
Version history
2.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
19 hits · last 30 days
node
18
Resources
gcs-browser-upload — npm install gcs-browser-upload · libregistry