Firebase Storage

Firebase Cloud Storage via the official firebase-admin SDK. Underlying client is @google-cloud/storage, so V4 signed URLs and POST policy uploads come for free.

Installation

firebase-admin is an optional peer dependency of files-sdk - install alongside the SDK so the adapter's imports resolve at runtime.

npm install files-sdk firebase-admin

Usage

Firebase Cloud Storage via the official firebase-admin SDK. The Admin SDK's getStorage().bucket() returns a @google-cloud/storage Bucket under the hood, so every primitive (server-side copy, V4 signed URLs, POST policy uploads) maps onto the GCS surface - with Firebase-flavoured credential conventions and a default bucket name derived from your project ID.

import { Files } from "files-sdk";
import { firebaseStorage } from "files-sdk/firebase-storage";

const files = new Files({
  adapter: firebaseStorage({
    bucket: "my-project.firebasestorage.app",
    // Auto-loads credentials from FIREBASE_PROJECT_ID,
    // FIREBASE_CLIENT_EMAIL, FIREBASE_PRIVATE_KEY, or falls back to
    // Application Default Credentials (GOOGLE_APPLICATION_CREDENTIALS,
    // gcloud auth, GCE metadata). Or pass an existing firebase-admin App
    // or @google-cloud/storage Bucket via `app`.
  }),
});

upload reports true byte-level progress via onProgress. As with GCS, passing onProgress switches the upload to a resumable request (the only path that emits progress), which adds one round trip.

Options

Prop

Type

Limitations

Firebase's ?alt=media&token=... download-token URL form is out of scope for v1 - url() always returns either a V4 signed read URL or your configured publicBaseUrl. Reach for adapter.raw (the underlying @google-cloud/storage Bucket) if you need to mint Firebase download tokens or use any GCS-side feature that isn't in the unified API. Stream uploads use single-request mode; multi-GB resumable uploads also need raw.

Compatibility

MethodStatusNotes
upload
download
delete
list
search
head
exists
copy
url
signedUploadUrl

On this page