React Native Firebase
    Preparing search index...

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

    Use the exported types directly instead. FirebaseStorageTypes namespace is kept for backwards compatibility.

    Get the storage instance for the default app:

    const storageForDefaultApp = firebase.storage();
    

    Get the storage instance for a secondary app:

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

    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');
    interface Module {
        app: ReactNativeFirebase.FirebaseApp;
        maxDownloadRetryTime: number;
        maxOperationRetryTime: number;
        maxUploadRetryTime: number;
        ref(path?: string): FirebaseStorageTypes.Reference;
        refFromURL(url: string): FirebaseStorageTypes.Reference;
        setMaxDownloadRetryTime(time: number): Promise<void>;
        setMaxOperationRetryTime(time: number): Promise<void>;
        setMaxUploadRetryTime(time: number): Promise<void>;
        useEmulator(host: string, port: number): void;
    }

    Hierarchy

    • FirebaseModule
      • Module
    Index

    Methods

    • Returns a new Reference instance from a storage bucket URL.

      const gsUrl = 'gs://react-native-firebase-testing/cats.gif';
      const httpUrl = 'https://firebasestorage.googleapis.com/v0/b/react-native-firebase-testing.appspot.com/o/cats.gif';

      const refFromGsUrl = firebase.storage().refFromURL(gsUrl);
      // or
      const refFromHttpUrl = firebase.storage().refFromURL(httpUrl);

      Parameters

      • url: string

        A storage bucket URL pointing to a single file or location. Must be either a gs:// url or an http url, e.g. gs://assets/logo.png or https://firebasestorage.googleapis.com/v0/b/react-native-firebase-testing.appspot.com/o/cats.gif.

      Returns FirebaseStorageTypes.Reference

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

      await firebase.storage().setMaxDownloadRetryTime(25000);
      

      Parameters

      • time: number

        The new maximum download retry time in milliseconds.

      Returns Promise<void>

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

      await firebase.storage().setMaxOperationRetryTime(5000);
      

      Parameters

      • time: number

        The new maximum operation retry time in milliseconds.

      Returns Promise<void>

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

      await firebase.storage().setMaxUploadRetryTime(25000);
      

      Parameters

      • time: number

        The new maximum upload retry time in milliseconds.

      Returns Promise<void>

    • 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.

      Note: on android, hosts 'localhost' and '127.0.0.1' are automatically remapped to '10.0.2.2' (the "host" computer IP address for android emulators) to make the standard development experience easy. If you want to use the emulator on a real android device, you will need to specify the actual host computer IP address.

      Parameters

      • host: string

        emulator host (eg, 'localhost')

      • port: number

        emulator port (eg, 9199)

      Returns void

    Properties

    The current FirebaseApp instance for this Firebase service.

    maxDownloadRetryTime: number

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

    const downloadRetryTime = firebase.storage().maxUploadRetryTime;
    
    maxOperationRetryTime: number

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

    const maxOperationRetryTime = firebase.storage().maxOperationRetryTime;
    
    maxUploadRetryTime: number

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

    const uploadRetryTime = firebase.storage().maxUploadRetryTime;