firebase-storage-kit

StorageManager

Main entry point for uploads and file operations.

StorageManager is the class you instantiate with a Firebase Storage instance. It starts uploads, exposes global state, and provides file query helpers.

Constructor

import { getStorage } from "firebase/storage";
import { StorageManager } from "firebase-storage-kit";

const manager = new StorageManager(getStorage(app));

Methods

uploadFile

uploadFile(file: File, options: UploadOptions): UploadHandle

Starts a single resumable upload. Returns an UploadHandle immediately — the upload runs asynchronously.

uploadFiles

uploadFiles(
  files: File[],
  optionsFor: (file: File, index: number) => UploadOptions,
  batchOptions?: BatchOptions
): BatchHandle

Uploads multiple files as one batch. See BatchHandle.

getState

getState(): StorageState

Returns { uploads, batches } — current snapshots of all tracked uploads and batches.

subscribe

subscribe(listener: (state: StorageState) => void): () => void

Calls listener on every state change. Returns an unsubscribe function.

exists

exists(path: string): Promise<boolean>

true if the object exists; false if not found; throws on other errors.

getMetadata

getMetadata(path: string): Promise<FileMetadata>

Returns object metadata. Throws if not found.

getDownloadURL

getDownloadURL(path: string): Promise<string>

Returns a download URL for the object at path.

delete

delete(path: string): Promise<void>

Deletes the object at path.

list

list(prefix: string, options?: ListOptions): Promise<StorageListResult>

Lists folders and files at prefix with optional pagination (maxResults, pageToken).

listAll

listAll(prefix: string): Promise<StorageListResult>

Lists all folders and files at prefix (auto-paginates internally).

On this page