@react-native-firebase/appinstalled and native config completed per Getting Started (Androidgoogle-services.json, iOSGoogleService-Info.plist, Expo config plugin, or React Native CLI setup). From v26, New Architecture is required for packages with a native bridge.- Install Storage:
npm install --save @react-native-firebase/storageoryarn add @react-native-firebase/storage, then rebuild native apps (cd ios && pod installon iOS). - Enable Cloud Storage in the Firebase Console for your project. Cloud Storage for Firebase requires the pay-as-you-go Blaze pricing plan. The default bucket is named
PROJECT_ID.firebasestorage.app(buckets created before September 2024 are namedPROJECT_ID.appspot.com). - Deploy security rules appropriate for your app. By default only authenticated users can read and write. List APIs need Rules version 2.
Example Expo Router screen: https://github.com/invertase/react-native-firebase/blob/main/test-expo/app/storage.tsx
This module requires that the @react-native-firebase/app module is already setup and installed. To install the "app" module, view the
Getting Started documentation.
# Install & setup the app module
yarn add @react-native-firebase/app
# Install the storage module
yarn add @react-native-firebase/storage
# If you're developing your app using iOS, run this command
cd ios/ && pod install{/* prettier-ignore */}
| Platforms | Android, iOS (native Firebase SDK); macOS via firebase-js-sdk web interop |
| New Architecture | Required from v26. See Migrating to v26. |
Platform notes: putFile and writeToFile are native-only file-path APIs with no firebase-js-sdk equivalent. Use FilePath from @react-native-firebase/app for device paths. On the web interop platform they reject because the helper is not supported there. setMaxOperationRetryTime, setMaxUploadRetryTime, and setMaxDownloadRetryTime are Android and iOS helpers (see Retry times). uploadBytes, getBlob, getBytes, and getStream are exported for API surface parity but always fail with a not implemented error on React Native Firebase (uploadBytes returns a rejected promise; the other three throw synchronously). Prefer uploadBytesResumable / uploadString / putFile for uploads and getDownloadURL / writeToFile for downloads. React Native Firebase also exports RN-only helpers such as SDK_VERSION, setMaxOperationRetryTime, setMaxUploadRetryTime, and setMaxDownloadRetryTime, plus types Task, TaskSnapshot, TaskResult, TaskSnapshotObserver, Subscribe, and NativeFirebaseError. Each is explained in the section that uses it.
Storage is built for app developers who need to store and serve user-generated content, such as photos or videos.
Your data is stored in a Google Cloud Storage bucket, an exabyte scale object storage solution with high availability and global redundancy. Storage lets you securely upload these files directly from mobile devices, handling spotty networks with ease.
Your files are stored in a Google Cloud Storage bucket. The files in this bucket are presented in a hierarchical structure, just like a file system. By creating a reference to a file, your app gains access to it. These references can then be used to upload or download data, get or update metadata or delete the file. A reference can either point to a specific file or to a higher level node in the hierarchy.
The Storage module also provides support for multiple buckets.
You can view your buckets on the Firebase Console.
Use connectStorageEmulator before any Storage uploads, downloads, metadata calls, list calls, or task listeners when talking to the Local Emulator Suite (the Cloud Storage emulator listens on port 9199 by default). On Android emulators, use 10.0.2.2 instead of localhost / 127.0.0.1 so the guest can reach the host machine.
import { Platform } from 'react-native';
import { connectStorageEmulator, getStorage } from '@react-native-firebase/storage';
const host = Platform.OS === 'android' ? '10.0.2.2' : '127.0.0.1';
connectStorageEmulator(getStorage(), host, 9199);On Android, connectStorageEmulator rewrites localhost and 127.0.0.1 to 10.0.2.2 and logs a message. Set android_bypass_emulator_url_remap to true in firebase.json to keep the host you pass (see JSON Config). Use your machine's IP address when running on a physical device. The call throws if host is empty or port is not a number.
A reference is a local pointer to some file on your bucket. This can either be a file which already exists, or one
which does not exist yet. To create a reference, use the ref method. Calling ref(storage) with no path returns a reference to the root of the bucket, and passing a path as the second argument points lower in the tree:
import { getStorage, ref } from '@react-native-firebase/storage';
const storage = getStorage();
const rootRef = ref(storage);
const reference = ref(storage, 'black-t-shirt-sm.png');
console.log('Root path:', rootRef.fullPath);
console.log('Reference path:', reference.fullPath);You can also specify a file located in a deeply nested directory, create a child from an existing reference, or rebuild a reference from a gs:// or https:// URL (pass the URL as the second argument to ref):
import { getApp } from '@react-native-firebase/app';
import { getStorage, ref } from '@react-native-firebase/storage';
const storage = getStorage();
const nested = ref(storage, '/images/t-shirts/black-t-shirt-sm.png');
const imagesRef = ref(storage, 'images');
const childRef = ref(imagesRef, 'space.jpg');
console.log('Nested and child paths:', nested.fullPath, childRef.fullPath);
const bucket = getApp().options.storageBucket;
const gsRef = ref(storage, `gs://${bucket}/images/space.jpg`);
console.log('gs:// reference path:', gsRef.fullPath);
const httpsRef = ref(
storage,
`https://firebasestorage.googleapis.com/v0/b/${bucket}/o/images%2Fspace.jpg?alt=media`,
);
console.log('https:// reference path:', httpsRef.fullPath);Use parent and root on a reference to walk up the hierarchy. parent moves one level up; root returns the bucket root. The parent of root is null. References can be chained: pass parent back into ref to create a sibling.
import { getStorage, ref } from '@react-native-firebase/storage';
const storage = getStorage();
const spaceRef = ref(storage, 'images/space.jpg');
const imagesRef = spaceRef.parent;
const rootRef = spaceRef.root;
console.log('Parent path:', imagesRef ? imagesRef.fullPath : null);
console.log('Root path:', rootRef.fullPath);
console.log('Parent of root:', rootRef.parent);
if (imagesRef) {
const earthRef = ref(imagesRef, 'earth.jpg');
console.log('Sibling path:', earthRef.fullPath);
}Inspect fullPath, name, and bucket on a reference:
import { getStorage, ref } from '@react-native-firebase/storage';
const storage = getStorage();
const spaceRef = ref(storage, 'images/space.jpg');
console.log('fullPath:', spaceRef.fullPath);
console.log('name:', spaceRef.name);
console.log('bucket:', spaceRef.bucket);Reference paths and names can contain valid Unicode characters, with these limits: fullPath must be between 1 and 1024 bytes when UTF-8 encoded, must not contain carriage return or line feed, and should avoid #, [, ], *, and ? (those characters interact poorly with other tools).
To upload a file directly from the users device, the putFile method accepts a string path to the file
on the users device. putFile is React Native Firebase-specific (no firebase-js-sdk equivalent) and is native only. Prefer FilePath from @react-native-firebase/app for portable device directories. The file must already exist at that path; otherwise the upload fails with the error code storage/file-not-found. When you do not pass a contentType, putFile derives one from the file.
import React from 'react';
import { View, Button } from 'react-native';
import { FilePath } from '@react-native-firebase/app';
import { getStorage, ref, putFile } from '@react-native-firebase/storage';
function UploadShirtButton() {
const storage = getStorage();
const reference = ref(storage, 'black-t-shirt-sm.png');
return (
<View>
<Button
title="Upload"
onPress={async () => {
const pathToFile = `${FilePath.DOCUMENT_DIRECTORY}/black-t-shirt-sm.png`;
await putFile(reference, pathToFile);
console.log('Uploaded via putFile');
}}
/>
</View>
);
}putFile, uploadBytesResumable, and uploadString return an upload Task, and writeToFile returns a download Task. Task is a React Native Firebase type alias for UploadTask, kept for consistency with the native task system. The snapshot type is TaskSnapshot, which extends UploadTaskSnapshot with an optional error field typed as NativeFirebaseError for native task error state. The Task methods are declared with UploadTaskSnapshot, so TypeScript code reads failure details from the error callback instead of snapshot.error.
A task starts the first time you call task.then, task.catch, task.on, or await it. Creating a task and not touching it does not start the transfer, and pause, resume, and cancel return false for a task that has not started.
Hook into progress with task.on(TaskEvent.STATE_CHANGED, observer). TaskEvent.STATE_CHANGED ('state_changed') is the only supported event name; any other value throws. The observer receives a TaskSnapshot every time the task reports progress, pauses, resumes, completes, or fails:
import { FilePath } from '@react-native-firebase/app';
import { getStorage, ref, putFile, TaskEvent } from '@react-native-firebase/storage';
const storage = getStorage();
const reference = ref(storage, 'black-t-shirt-sm.png');
const pathToFile = `${FilePath.DOCUMENT_DIRECTORY}/black-t-shirt-sm.png`;
const task = putFile(reference, pathToFile);
task.on(TaskEvent.STATE_CHANGED, taskSnapshot => {
console.log(`${taskSnapshot.bytesTransferred} transferred out of ${taskSnapshot.totalBytes}`);
});
task.then(taskSnapshot => {
console.log('Image uploaded to the bucket!', taskSnapshot.state);
});On successful completion, task.then / await task resolves with the final snapshot. TaskResult is a separate type alias for UploadResult, the typed return of uploadBytes (which always fails on React Native Firebase); it is not the Task fulfillment value. task.snapshot holds the most recent snapshot.
Each TaskSnapshot has these properties:
{/* prettier-ignore */}
| Property | Type | Description |
|---|---|---|
bytesTransferred | number | Bytes transferred when the snapshot was taken. |
totalBytes | number | Total bytes expected. |
state | TaskState string | Current state of the task. |
metadata | FullMetadata | Metadata sent to the server before completion, metadata returned by the server after. |
task | Task | The task the snapshot belongs to. |
ref | StorageReference | The reference the task came from. |
error | NativeFirebaseError (optional) | Set when the task failed. |
TaskState is a runtime export with the constants RUNNING ('running'), PAUSED ('paused'), SUCCESS ('success'), and ERROR ('error'). Compare snapshot.state with these constants to react to a task starting, pausing, resuming, or finishing. TaskState also exports CANCELED and CANCELLED; detect cancellation through the storage/cancelled error code (see Handle errors) instead of comparing snapshot.state.
import { FilePath } from '@react-native-firebase/app';
import { getStorage, ref, putFile, TaskEvent, TaskState } from '@react-native-firebase/storage';
const storage = getStorage();
const reference = ref(storage, 'black-t-shirt-sm.png');
const pathToFile = `${FilePath.DOCUMENT_DIRECTORY}/black-t-shirt-sm.png`;
const task = putFile(reference, pathToFile);
task.on(TaskEvent.STATE_CHANGED, snapshot => {
const progress = (snapshot.bytesTransferred / snapshot.totalBytes) * 100;
console.log(`Upload is ${progress}% done`);
switch (snapshot.state) {
case TaskState.PAUSED:
console.log('Upload is paused');
break;
case TaskState.RUNNING:
console.log('Upload is running');
break;
case TaskState.SUCCESS:
console.log('Upload finished');
break;
case TaskState.ERROR:
console.log('Upload failed');
break;
}
});
task.catch(error => {
console.log('Upload rejected with', error.code);
});pause(), resume(), and cancel() return a boolean synchronously. They return true when the call took effect and false when it was ignored (for example pause() on a task that is already paused or finished, resume() on a task that is not paused, or any of them before the task has started). Calling cancel() on a running or paused task makes it fail with the error code storage/cancelled: the error callback of task.on is called and the task promise rejects.
Call these once the task is transferring. This example pauses on the first running snapshot, resumes when the paused snapshot arrives, and cancels the second time the task is running:
import { FilePath } from '@react-native-firebase/app';
import { getStorage, ref, putFile, TaskEvent, TaskState } from '@react-native-firebase/storage';
const storage = getStorage();
const reference = ref(storage, 'black-t-shirt-sm.png');
const pathToFile = `${FilePath.DOCUMENT_DIRECTORY}/black-t-shirt-sm.png`;
const task = putFile(reference, pathToFile);
let pausedOnce = false;
let resumedOnce = false;
task.on(
TaskEvent.STATE_CHANGED,
snapshot => {
if (snapshot.state === TaskState.RUNNING && !pausedOnce) {
pausedOnce = true;
console.log('pause() took effect:', task.pause());
} else if (snapshot.state === TaskState.PAUSED && !resumedOnce) {
resumedOnce = true;
console.log('resume() took effect:', task.resume());
} else if (snapshot.state === TaskState.RUNNING && resumedOnce) {
console.log('cancel() took effect:', task.cancel());
}
},
error => {
console.log('Task ended with', error.code);
},
);
task.catch(() => {
console.log('Task promise rejected');
});Pass an error callback and a completion callback as the third and fourth arguments to task.on, or pass a TaskSnapshotObserver (StorageObserver<TaskSnapshot>, an object with next, error, and complete) as the second argument. task.on starts the task but does not attach a rejection handler to the task promise, so also call task.catch (or await the task in a try block) to avoid an unhandled rejection.
import { FilePath } from '@react-native-firebase/app';
import {
getStorage,
ref,
putFile,
getDownloadURL,
TaskEvent,
TaskState,
} from '@react-native-firebase/storage';
const storage = getStorage();
const reference = ref(storage, 'images/mountains.jpg');
const pathToFile = `${FilePath.DOCUMENT_DIRECTORY}/mountains.jpg`;
const task = putFile(reference, pathToFile, { contentType: 'image/jpeg' });
task.on(
TaskEvent.STATE_CHANGED,
snapshot => {
const progress = (snapshot.bytesTransferred / snapshot.totalBytes) * 100;
console.log(`Upload is ${progress}% done`);
if (snapshot.state === TaskState.PAUSED) {
console.log('Upload is paused');
}
},
error => {
switch (error.code) {
case 'storage/file-not-found':
console.log('The local file does not exist');
break;
case 'storage/unauthorized':
console.log('User is not authorized to upload the file');
break;
case 'storage/cancelled':
console.log('Upload was cancelled');
break;
default:
console.log('Upload failed', error.code, error.message);
}
},
async () => {
const downloadURL = await getDownloadURL(reference);
console.log('File available at', downloadURL);
},
);
task.catch(() => {
console.log('Task promise rejected');
});The observers are removed after the task fails, and after it succeeds when you passed a completion callback. The function that task.on returns removes them earlier. When you call task.on(event) with only the event name, the runtime returns a Subscribe function (an RN helper type) that attaches the observers later and returns the unsubscribe function. The declared return type of task.on is a union, so TypeScript code casts it to Subscribe<TaskSnapshot> before calling it:
import { FilePath } from '@react-native-firebase/app';
import {
getStorage,
ref,
putFile,
TaskEvent,
type Subscribe,
type TaskSnapshot,
} from '@react-native-firebase/storage';
const storage = getStorage();
const reference = ref(storage, 'black-t-shirt-sm.png');
const pathToFile = `${FilePath.DOCUMENT_DIRECTORY}/black-t-shirt-sm.png`;
const task = putFile(reference, pathToFile);
const subscribe = task.on(TaskEvent.STATE_CHANGED) as Subscribe<TaskSnapshot>;
const unsubscribe = subscribe(
(snapshot: TaskSnapshot) => {
console.log('state:', snapshot.state);
},
error => {
console.log('error:', error.code);
},
() => {
console.log('complete');
},
);
task.catch(() => {
console.log('Task promise rejected');
unsubscribe();
});Prefer uploadBytesResumable for in-memory Uint8Array, ArrayBuffer, or Blob uploads (pause and resume via the same Task API). Data is handed to the native module as an encoded string, so use putFile for large files. uploadBytes is exported for firebase-js-sdk surface parity but always fails (uploadBytes() is not implemented) on React Native Firebase.
import { getStorage, ref, uploadBytesResumable } from '@react-native-firebase/storage';
const storage = getStorage();
const storageRef = ref(storage, 'expo/hello.bin');
const bytes = new Uint8Array([0x48, 0x65, 0x6c, 0x6c, 0x6f]);
const task = uploadBytesResumable(storageRef, bytes);
task.on('state_changed', snapshot => {
const progress = (snapshot.bytesTransferred / snapshot.totalBytes) * 100;
console.log('Upload is ' + progress + '% done');
});
await task;
console.log('Uploaded bytes');Upload a raw, base64, base64url, or data_url string with uploadString (returns a Task on React Native Firebase, not a bare Promise). The default format is raw. A data_url string supplies the contentType from its media type when you do not pass one:
import { getStorage, ref, uploadString, StringFormat } from '@react-native-firebase/storage';
const storage = getStorage();
const storageRef = ref(storage, 'expo/message.txt');
await uploadString(storageRef, 'This is my message.', StringFormat.RAW);
await uploadString(storageRef, 'SGVsbG8=', StringFormat.BASE64);
await uploadString(storageRef, 'SGVsbG8', StringFormat.BASE64URL);
await uploadString(storageRef, 'data:text/plain;base64,SGVsbG8=', StringFormat.DATA_URL);
console.log('Uploaded strings');You can attach metadata (for example contentType) on upload. uploadString, uploadBytesResumable, and putFile all take the metadata object as their last argument:
import { getStorage, ref, uploadString } from '@react-native-firebase/storage';
const storage = getStorage();
const storageRef = ref(storage, 'images/mountains.jpg');
const metadata = { contentType: 'image/jpeg' };
await uploadString(storageRef, 'fake-image-bytes', 'raw', metadata);
console.log('Uploaded with metadata');A common use-case for Cloud Storage is to use it as a global Content Delivery Network (CDN) for your images. When uploading
files to a bucket, they are not automatically available for consumption via a HTTP URL. To generate a Download URL, you
need to call the getDownloadURL method on a reference:
import { getStorage, ref, getDownloadURL } from '@react-native-firebase/storage';
const storage = getStorage();
const url = await getDownloadURL(ref(storage, 'images/profile-1.png'));
console.log('Download URL:', url);Images uploaded manually via the Firebase Console automatically generate a download URL.
writeToFile downloads a Cloud Storage object to a local device path. It is React Native Firebase-specific (no firebase-js-sdk equivalent), returns a Task, and is native only. The returned task supports task.on, pause, resume, and cancel like an upload task. Use it instead of the web getBlob / getBytes / getStream helpers: those three are exported for surface parity but always throw (not implemented) on React Native Firebase.
import { FilePath } from '@react-native-firebase/app';
import { getStorage, ref, writeToFile, TaskEvent } from '@react-native-firebase/storage';
const storage = getStorage();
const reference = ref(storage, 'images/profile-1.png');
const localPath = `${FilePath.DOCUMENT_DIRECTORY}/profile-1.png`;
const task = writeToFile(reference, localPath);
task.on(TaskEvent.STATE_CHANGED, snapshot => {
console.log(`${snapshot.bytesTransferred} downloaded out of ${snapshot.totalBytes}`);
});
await task;
console.log('Downloaded to', localPath);Read object metadata with getMetadata, and change writable fields with updateMetadata. Set a writable property to null to remove it. Custom metadata is a string-to-string map under customMetadata; set a key inside it to null to remove that key.
import { getStorage, ref, getMetadata, updateMetadata } from '@react-native-firebase/storage';
const storage = getStorage();
const forestRef = ref(storage, 'images/forest.jpg');
const metadata = await getMetadata(forestRef);
console.log('contentType:', metadata.contentType);
const updated = await updateMetadata(forestRef, {
cacheControl: 'public,max-age=300',
contentType: 'image/jpeg',
customMetadata: {
location: 'Yosemite, CA, USA',
activity: 'Hiking',
},
});
console.log('Updated contentType:', updated.contentType);
await updateMetadata(forestRef, { contentType: null });
console.log('Cleared contentType');updateMetadata throws if the metadata object has an unknown property, a value that is not a string or null, or md5Hash, which can only be set on upload.
{/* prettier-ignore */}
| Property | Type | Writable |
|---|---|---|
bucket | string | NO |
generation | string | NO |
metageneration | string | NO |
fullPath | string | NO |
name | string | NO |
size | number | NO |
timeCreated | string | NO |
updated | string | NO |
md5Hash | string | YES on upload, NO on updateMetadata |
cacheControl | string | YES |
contentDisposition | string | YES |
contentEncoding | string | YES |
contentLanguage | string | YES |
contentType | string | YES |
customMetadata | Object containing string-to-string mappings | YES |
Projects that use the List API require Cloud Storage for Firebase Rules version 2. Use list for paginated results, or listAll for small directories (all results are buffered in memory). list takes maxResults (an integer from 1 to 1000, default 1000) and pageToken; the result has items, prefixes, and a nextPageToken when more results exist. Folders are implicit: a prefix is a path segment shared by objects, and you can call list or listAll on a prefix reference.
import { getStorage, ref, list, listAll } from '@react-native-firebase/storage';
async function listFilesAndDirectories(reference, pageToken) {
const result = await list(reference, { pageToken, maxResults: 100 });
result.items.forEach(itemRef => {
console.log('item:', itemRef.fullPath);
});
result.prefixes.forEach(folderRef => {
console.log('prefix:', folderRef.fullPath);
});
if (result.nextPageToken) {
return listFilesAndDirectories(reference, result.nextPageToken);
}
}
const storage = getStorage();
const reference = ref(storage, 'images');
await listFilesAndDirectories(reference);
console.log('Finished paginated listing');
const all = await listAll(reference);
console.log('listAll item count:', all.items.length);Delete an object with deleteObject. The call fails with storage/object-not-found when the object does not exist:
import { getStorage, ref, deleteObject } from '@react-native-firebase/storage';
const storage = getStorage();
const desertRef = ref(storage, 'images/desert.jpg');
await deleteObject(desertRef);
console.log('File deleted');On Android and iOS, set maximum retry times (in milliseconds) with React Native Firebase modular helpers. The firebase-js-sdk exposes upload/operation retry times as writable properties on FirebaseStorage; React Native Firebase uses dedicated functions instead. setMaxDownloadRetryTime has no direct firebase-js-sdk equivalent. Each helper throws if time is not a number. On the web interop platform setMaxDownloadRetryTime does nothing except log a warning in development builds.
import {
getStorage,
setMaxOperationRetryTime,
setMaxUploadRetryTime,
setMaxDownloadRetryTime,
} from '@react-native-firebase/storage';
const storage = getStorage();
await setMaxOperationRetryTime(storage, 10_000);
await setMaxUploadRetryTime(storage, 60_000);
await setMaxDownloadRetryTime(storage, 60_000);
console.log('maxOperationRetryTime:', storage.maxOperationRetryTime);
console.log('maxUploadRetryTime:', storage.maxUploadRetryTime);
console.log('maxDownloadRetryTime:', storage.maxDownloadRetryTime);Storage operations reject with errors whose code is storage/ followed by the error name (for example storage/object-not-found, storage/unauthorized, storage/cancelled). On React Native Firebase, those errors are NativeFirebaseError instances from the native bridge (re-exported from @react-native-firebase/storage) rather than the firebase-js-sdk StorageError / StorageErrorCode enum. Upload and download task failures reach the error callback of task.on and reject the task promise.
import { getStorage, ref, getDownloadURL } from '@react-native-firebase/storage';
const storage = getStorage();
const starsRef = ref(storage, 'images/stars.jpg');
try {
const url = await getDownloadURL(starsRef);
console.log('Download URL:', url);
} catch (error) {
const code = error && typeof error === 'object' && 'code' in error ? error.code : undefined;
switch (code) {
case 'storage/object-not-found':
console.log('File does not exist');
break;
case 'storage/unauthorized':
console.log('User is not authorized');
break;
case 'storage/cancelled':
console.log('User cancelled the operation');
break;
case 'storage/unknown':
console.log('Unknown error', error);
break;
default:
console.log('Storage error', error);
}
}The native modules produce these codes:
{/* prettier-ignore */}
| Code | Reason |
|---|---|
storage/unknown | An unknown error occurred. |
storage/object-not-found | No object exists at the reference. |
storage/bucket-not-found | No bucket is configured for Cloud Storage. |
storage/project-not-found | No project is configured for Cloud Storage. |
storage/quota-exceeded | The quota on the bucket has been exceeded. |
storage/unauthenticated | The user is unauthenticated. |
storage/unauthorized | The user is not authorized to perform the action; check your security rules. |
storage/retry-limit-exceeded | The maximum time limit on an operation (upload, download, delete, and so on) has been exceeded. |
storage/non-matching-checksum | The file on the client does not match the checksum of the file received by the server. |
storage/cancelled | The task was stopped with task.cancel(). |
storage/file-not-found | The local file passed to putFile does not exist. |
storage/invalid-device-file-path | iOS only: the device file path is invalid or restricted. |
storage/download-size-exceeded | iOS only: the downloaded file exceeds the memory allocated for the download. |
Invalid arguments, such as an unknown metadata property, an unsupported string format, a maxResults outside 1 to 1000, or a bucket URL that does not start with gs://, throw a plain Error synchronously and carry no storage/ code. See the Firebase web handle-errors guide for the firebase-js-sdk error list; the web names storage/canceled and storage/invalid-checksum are storage/cancelled and storage/non-matching-checksum on React Native Firebase.
By default your bucket will come with rules which allows only authenticated users on your project to access it. You can however fully customize the security rules to your own applications requirements.
To learn more, view the Storage Security documentation on the Firebase website.
A single Firebase project can have multiple storage buckets. The module will use the default bucket if no bucket argument
is passed to getStorage. To switch buckets, provide the gs:// bucket URL found on the
Firebase Console, under Storage > Files. The same pattern works with a custom Firebase App instance:
import { getApp } from '@react-native-firebase/app';
import { getStorage } from '@react-native-firebase/storage';
const app = getApp();
const defaultStorageBucket = getStorage();
const secondaryStorageBucket = getStorage(app, 'gs://my-secondary-bucket.appspot.com');
const customAppDefault = getStorage(app);
console.log('Default bucket app:', defaultStorageBucket.app.name);
console.log('Secondary bucket app:', secondaryStorageBucket.app.name);
console.log('Custom app default bucket:', customAppDefault.app.name);SDK_VERSION is the React Native Firebase Storage package version string exported from @react-native-firebase/storage. The firebase-js-sdk does not export SDK_VERSION from @firebase/storage.
import { SDK_VERSION } from '@react-native-firebase/storage';
console.log('Storage package version:', SDK_VERSION);
Core / App