firebase-storage-kit

BatchHandle

Control and observe a multi-file upload batch.

A BatchHandle is returned from StorageManager.uploadFiles. It coordinates multiple child UploadHandle instances.

Properties

PropertyTypeDescription
idstringBatch identifier
uploadsUploadHandle[]Child handles (same order as input files)

Methods

snapshot

snapshot(): UploadBatch

Returns current aggregate state: totalProgress, completedCount, failedCount, and child upload items.

pause

pause(): void

Pauses all active uploads in the batch.

resume

resume(): void

Resumes all paused uploads in the batch.

on

Subscribe to batch-level events (same pattern as UploadHandle.on).

Events

EventPayloadDescription
progressUploadBatchAggregate progress changed
changeUploadBatchAny batch property changed
uploadSuccessUploadItemOne child succeeded
uploadErrorUploadItemOne child failed
uploadRetryUploadRetryEventOne child is retrying
successUploadBatchAll children settled
errorUploadBatchBatch failed fast (continueOnError: false)

BatchOptions

Passed as the third argument to uploadFiles:

interface BatchOptions {
  concurrency?: number; // default 3
  continueOnError?: boolean; // default true
}

Example

const batch = manager.uploadFiles(
  files,
  (f) => ({ path: `uploads/${f.name}` }),
  { concurrency: 2 }
);

batch.on("progress", (s) => console.log(s.totalProgress));
batch.on("uploadSuccess", (item) => console.log(item.path));
batch.on("success", (s) => console.log(s.completedCount));

On this page