Jump to top

storage

interface

The Cloud Storage service is available for the default app, a given app or a specific storage bucket.

Example 1

Get the storage instance for the default app:

const storageForDefaultApp = firebase.storage();
Example 2

Get the storage instance for a secondary app:

const otherApp = firebase.app('otherApp');
const storageForOtherApp = firebase.storage(otherApp);
Example 3

Get the storage instance for a specific storage bucket:

const defaultApp = firebase.app();
const storageForBucket = defaultApp.storage('gs://another-bucket-url');

const otherApp = firebase.app('otherApp');
const storageForOtherAppBucket = otherApp.storage('gs://another-bucket-url');

Properties

maxDownloadRetryTime

</>

Returns the current maximum time in milliseconds to retry a download if a failure occurs.

maxDownloadRetryTime: number;

maxOperationRetryTime

</>

Returns the current maximum time in milliseconds to retry operations other than upload and download if a failure occurs.

maxOperationRetryTime: number;

maxUploadRetryTime

</>

Returns the current maximum time in milliseconds to retry an upload if a failure occurs.

maxUploadRetryTime: number;

Methods

ref

</>

Returns a new Reference instance.

ref(path?: undefined | string): Reference;

refFromURL

</>

Returns a new Reference instance from a storage bucket URL.

refFromURL(url: string): Reference;

setMaxDownloadRetryTime

</>

Sets the maximum time in milliseconds to retry a download if a failure occurs.

setMaxDownloadRetryTime(time: number): Promise<void>;

setMaxOperationRetryTime

</>

Sets the maximum time in milliseconds to retry operations other than upload and download if a failure occurs.

setMaxOperationRetryTime(time: number): Promise<void>;

setMaxUploadRetryTime

</>

Sets the maximum time in milliseconds to retry an upload if a failure occurs.

setMaxUploadRetryTime(time: number): Promise<void>;

useEmulator

</>

Modify this Storage instance to communicate with the Firebase Storage emulator. This must be called synchronously immediately following the first call to firebase.storage(). Do not use with production credentials as emulator traffic is not encrypted.

useEmulator(host: string, port: number): void;

Statics

StringFormat

</>

Possible string formats used for uploading via StorageReference.putString()

storage.StringFormat: StringFormat;

TaskEvent

</>

An event to subscribe to that is triggered on a Upload or Download task.

storage.TaskEvent: TaskEvent;

TaskState

</>

A collection of properties that indicates the current tasks state.

storage.TaskState: TaskState;