---
description: Unofficial Capacitor plugin for Firebase Cloud Storage SDK to upload and download files in your app.
title: Capacitor Firebase Storage Plugin for Android, iOS & Web - Capawesome
image: https://capawesome.io/docs/assets/images/social/sdks/capacitor/firebase/cloud-storage.png
---

<!doctype html> 

[Skip to content ](#capacitor-firebasestorage) 

[🖥️ Introducing the **Capacitor Electron Platform** — build desktop apps for macOS, Windows, and Linux. Free & open source. ](/blog/announcing-the-capacitor-electron-platform/) 

* [ SDKs ](/docs/sdks/)
* [ iOS ](#ios)
* [ Configuration ](#configuration)
* [ Demo ](#demo)
* [ Starter templates ](#starter-templates)
* [ Usage ](#usage)
* [ API ](#api)
* [ Type Aliases ](#type-aliases)
* [ FAQ ](#faq)
* [ Related Plugins ](#related-plugins)
* [ Newsletter ](#newsletter)
* [ Changelog ](#changelog)
* [ License ](#license)
* [ Performance Monitoring ](/docs/sdks/capacitor/firebase/performance-monitoring/)
* [ Remote Config ](/docs/sdks/capacitor/firebase/remote-config/)
* [ Formbricks ](/docs/sdks/capacitor/formbricks/)
* [ Geocoder ](/docs/sdks/capacitor/geocoder/)
* [ Google Sign-In ](/docs/sdks/capacitor/google-sign-in/)
* [ Grafana Faro ](/docs/sdks/capacitor/grafana-faro/)
* [ Gyroscope ](/docs/sdks/capacitor/gyroscope/)
* [ Haptics ](/docs/sdks/capacitor/haptics/)
* [ Home Indicator ](/docs/sdks/capacitor/home-indicator/)
* [ In-App Browser ](/docs/sdks/capacitor/in-app-browser/)
* [ Install Referrer ](/docs/sdks/capacitor/install-referrer/)
* [ Intercom ](/docs/sdks/capacitor/intercom/)
* [ Intune ](/docs/sdks/capacitor/intune/)
* [ Keep Awake ](/docs/sdks/capacitor/keep-awake/)
* [ libSQL ](/docs/sdks/capacitor/libsql/)
* [ Light Sensor ](/docs/sdks/capacitor/light-sensor/)
* [ Live Update ](/docs/sdks/capacitor/live-update/)
* [ Localization ](/docs/sdks/capacitor/localization/)
* [ Mail Composer ](/docs/sdks/capacitor/mail-composer/)
* [ Managed Configurations ](/docs/sdks/capacitor/managed-configurations/)
* [ Maps Launcher ](/docs/sdks/capacitor/maps-launcher/)
* [ Media Session ](/docs/sdks/capacitor/media-session/)
* [ ML Kit ](/docs/sdks/capacitor/mlkit/)
* [ Navigation Bar ](/docs/sdks/capacitor/navigation-bar/)
* [ Network ](/docs/sdks/capacitor/network/)
* [ NFC ](/docs/sdks/capacitor/nfc/)
* [ Node.js ](/docs/sdks/capacitor/nodejs/)
* [ OAuth ](/docs/sdks/capacitor/oauth/)
* [ Passkeys ](/docs/sdks/capacitor/passkeys/)
* [ Password Autofill ](/docs/sdks/capacitor/password-autofill/)
* [ PDF Generator ](/docs/sdks/capacitor/pdf-generator/)
* [ PDF Viewer ](/docs/sdks/capacitor/pdf-viewer/)
* [ Pedometer ](/docs/sdks/capacitor/pedometer/)
* [ Permissions ](/docs/sdks/capacitor/permissions/)
* [ Phone Dialer ](/docs/sdks/capacitor/phone-dialer/)
* [ Photo Editor ](/docs/sdks/capacitor/photo-editor/)
* [ Photo Manipulator ](/docs/sdks/capacitor/photo-manipulator/)
* [ PixLive ](/docs/sdks/capacitor/pixlive/)
* [ PostHog ](/docs/sdks/capacitor/posthog/)
* [ Printer ](/docs/sdks/capacitor/printer/)
* [ Privacy Screen ](/docs/sdks/capacitor/privacy-screen/)
* [ Proximity Sensor ](/docs/sdks/capacitor/proximity-sensor/)
* [ Purchases ](/docs/sdks/capacitor/purchases/)
* [ RealtimeKit ](/docs/sdks/capacitor/realtimekit/)
* [ Root Detection ](/docs/sdks/capacitor/root-detection/)
* [ Screen Brightness ](/docs/sdks/capacitor/screen-brightness/)
* [ Screen Orientation ](/docs/sdks/capacitor/screen-orientation/)
* [ Screen Reader ](/docs/sdks/capacitor/screen-reader/)
* [ Screenshot ](/docs/sdks/capacitor/screenshot/)
* [ Secure Preferences ](/docs/sdks/capacitor/secure-preferences/)
* [ Settings Launcher ](/docs/sdks/capacitor/settings-launcher/)
* [ Shake ](/docs/sdks/capacitor/shake/)
* [ Silent Mode ](/docs/sdks/capacitor/silent-mode/)
* [ SIM ](/docs/sdks/capacitor/sim/)
* [ SMS Composer ](/docs/sdks/capacitor/sms-composer/)
* [ Speech Recognition ](/docs/sdks/capacitor/speech-recognition/)
* [ Speech Synthesis ](/docs/sdks/capacitor/speech-synthesis/)
* [ Share Target ](/docs/sdks/capacitor/share-target/)
* [ Square Mobile Payments ](/docs/sdks/capacitor/square-mobile-payments/)
* [ SQLite ](/docs/sdks/capacitor/sqlite/)
* [ Superwall ](/docs/sdks/capacitor/superwall/)
* [ System WebView ](/docs/sdks/capacitor/system-webview/)
* [ Tauri ](/docs/sdks/capacitor/tauri/)
* [ Text Interaction ](/docs/sdks/capacitor/text-interaction/)
* [ Text Zoom ](/docs/sdks/capacitor/text-zoom/)
* [ Thermal State ](/docs/sdks/capacitor/thermal-state/)
* [ Toast ](/docs/sdks/capacitor/toast/)
* [ Torch ](/docs/sdks/capacitor/torch/)
* [ Vault ](/docs/sdks/capacitor/vault/)
* [ Volume ](/docs/sdks/capacitor/volume/)
* [ Wallet ](/docs/sdks/capacitor/wallet/)
* [ Wifi ](/docs/sdks/capacitor/wifi/)
* [ YouTube Player ](/docs/sdks/capacitor/youtube-player/)
* [ Zip ](/docs/sdks/capacitor/zip/)
* [ Cordova ](/docs/sdks/cordova/)
* [ Cloud ](/docs/cloud/)
* [ Integrations ](/docs/cloud/live-updates/integrations/)
* Concepts
* Reference
* [ Troubleshooting ](/docs/cloud/live-updates/troubleshooting/)
* [ FAQ ](/docs/cloud/live-updates/faq/)
* [ Native Builds ](/docs/cloud/native-builds/)
* [ Set Up Environments ](/docs/cloud/native-builds/environments/)
* [ Overwrite Native Configurations ](/docs/cloud/native-builds/native-configurations/)
* [ Auto-Increment Build Numbers ](/docs/cloud/native-builds/auto-incrementing-build-numbers/)
* [ Configure the Web Build Script ](/docs/cloud/native-builds/web-build-script/)
* [ Build from a Monorepo ](/docs/cloud/native-builds/monorepo/)
* [ Use pnpm, Yarn, or bun ](/docs/cloud/native-builds/package-managers/)
* [ Install Private npm Packages ](/docs/cloud/native-builds/npm-private-registry/)
* [ Override the Java Version ](/docs/cloud/native-builds/override-java-version/)
* [ Custom iOS Provisioning Profiles ](/docs/cloud/native-builds/custom-ios-provisioning-profiles/)
* [ Build without Git ](/docs/cloud/native-builds/build-without-git/)
* [ Access Git Behind a Firewall ](/docs/cloud/native-builds/firewall-access/)
* [ Integrations ](/docs/cloud/native-builds/integrations/)
* Reference
* [ Troubleshooting ](/docs/cloud/native-builds/troubleshooting/)
* [ FAQ ](/docs/cloud/native-builds/faq/)
* [ App Store Publishing ](/docs/cloud/app-store-publishing/)
* [ Submit a Build ](/docs/cloud/app-store-publishing/submit-a-build/)
* [ Submit Automatically After a Build ](/docs/cloud/app-store-publishing/submit-automatically/)
* [ Troubleshooting ](/docs/cloud/app-store-publishing/troubleshooting/)
* [ FAQ ](/docs/cloud/app-store-publishing/faq/)
* [ Automations ](/docs/cloud/automations/)
* [ Reference ](/docs/cloud/automations/reference/)
* [ Troubleshooting ](/docs/cloud/automations/troubleshooting/)
* [ FAQ ](/docs/cloud/automations/faq/)
* [ Assist ](/docs/cloud/assist/)
* [ CLI ](/docs/cloud/cli/)
* APIs and SDKs
* [ Webhooks ](/docs/cloud/webhooks/)
* [ Integrations ](/docs/cloud/integrations/)
* Account
* [ Organization ](/docs/cloud/organizations/)
* [ Two-Factor Enforcement ](/docs/cloud/organizations/two-factor-authentication/)
* [ Audit Logs ](/docs/cloud/organizations/audit-logs/)
* [ Billing ](/docs/cloud/organizations/billing/)
* [ License Keys ](/docs/cloud/license-keys/)
* [ AI ](/docs/ai/)
* [ Insiders ](/docs/insiders/)
* [ Billing & Plans ](/docs/insiders/billing-and-plans/)
* [ FAQ ](/docs/insiders/faq/)
* [ License ](https://capawesome.io/legal/eula/)
* [ Support ](/docs/support/)
* [ Contributing ](/docs/contributing/)
* Contributing code
* [ Code of Conduct ](/docs/contributing/code-of-conduct/)
* [ Questions ](https://docs.github.com/en/discussions/collaborating-with-your-community-using-discussions/participating-in-a-discussion#creating-a-discussion)
* [ Blog ](/blog/)
* Categories

* [ iOS ](#ios)
* [ Configuration ](#configuration)
* [ Demo ](#demo)
* [ Starter templates ](#starter-templates)
* [ Usage ](#usage)
* [ API ](#api)
* [ Type Aliases ](#type-aliases)
* [ FAQ ](#faq)
* [ Related Plugins ](#related-plugins)
* [ Newsletter ](#newsletter)
* [ Changelog ](#changelog)
* [ License ](#license)

# @capacitor-firebase/storage[¶](#capacitor-firebasestorage "Permanent link")

Unofficial Capacitor plugin for [Firebase Cloud Storage](https://firebase.google.com/docs/storage/).[1](#fn:1)

[ ![Deliver Live Updates to your Capacitor app with Capawesome Cloud](../../../../assets/external/cloud.capawesome.io/assets/banners/cloud-build-and-deploy-capacitor-apps.69628c3f.png) ](https://cloud.capawesome.io/) 

## Use Cases[¶](#use-cases "Permanent link")

The Firebase Cloud Storage plugin is typically used to store and serve user-generated content, for example:

* **User-generated content**: Upload photos or other files created by your users to Cloud Storage.
* **File downloads**: Download files to the local file system on Android and iOS or as a `Blob` on the Web.
* **Content delivery**: Retrieve the download URL of a file to display or share it.
* **File management**: List the files in a directory, read and update their metadata, or delete them.

## Compatibility[¶](#compatibility "Permanent link")

| Plugin Version | Capacitor Version | Status         |
| -------------- | ----------------- | -------------- |
| 8.x.x          | \>=8.x.x          | Active support |
| 7.x.x          | 7.x.x             | Deprecated     |
| 6.x.x          | 6.x.x             | Deprecated     |

## Installation[¶](#installation "Permanent link")

You can use our **AI-Assisted Setup** to install the plugin. Add the [Capawesome Skills](https://github.com/capawesome-team/skills) to your AI tool using the following command:

`[](#%5F%5Fcodelineno-0-1)npx skills add capawesome-team/skills --skill capacitor-plugins
`

Then use the following prompt:

`` [](#%5F%5Fcodelineno-1-1)Use the `capacitor-plugins` skill from `capawesome-team/skills` to install the `@capacitor-firebase/storage` plugin in my project.
 ``

If you prefer **Manual Setup**, install the plugin by running the following commands and follow the platform-specific instructions below:

`[](#%5F%5Fcodelineno-2-1)npm install @capacitor-firebase/storage
[](#%5F%5Fcodelineno-2-2)npx cap sync
`

Add Firebase to your project if you haven't already ([Android](https://firebase.google.com/docs/android/setup) / [iOS](https://firebase.google.com/docs/ios/setup)).

### Android[¶](#android "Permanent link")

#### Variables[¶](#variables "Permanent link")

If needed, you can define the following project variable in your app’s `variables.gradle` file to change the default version of the dependency:

* `$firebaseStorageVersion` version of `com.google.firebase:firebase-storage` (default: `22.0.1`)

This can be useful if you encounter dependency conflicts with other plugins in your project.

### iOS[¶](#ios "Permanent link")

#### Swift Package Manager[¶](#swift-package-manager "Permanent link")

Add the following to your `capacitor.config.json` (or `capacitor.config.ts`) to avoid a [SwiftPM package identity collision](https://github.com/capawesome-team/capacitor-firebase/issues/959):

`[](#%5F%5Fcodelineno-3-1){
[](#%5F%5Fcodelineno-3-2)  "experimental": {
[](#%5F%5Fcodelineno-3-3)    "ios": {
[](#%5F%5Fcodelineno-3-4)      "spm": {
[](#%5F%5Fcodelineno-3-5)        "packageOptions": {
[](#%5F%5Fcodelineno-3-6)          "@capacitor-firebase/storage": {
[](#%5F%5Fcodelineno-3-7)            "symlink": true
[](#%5F%5Fcodelineno-3-8)          }
[](#%5F%5Fcodelineno-3-9)        }
[](#%5F%5Fcodelineno-3-10)      }
[](#%5F%5Fcodelineno-3-11)    }
[](#%5F%5Fcodelineno-3-12)  }
[](#%5F%5Fcodelineno-3-13)}
`

**Attention**: SPM `packageOptions` support requires Capacitor CLI **8.4.0+**.

## Configuration[¶](#configuration "Permanent link")

No configuration required for this plugin.

## Demo[¶](#demo "Permanent link")

A working example can be found here: [robingenz/capacitor-firebase-plugin-demo](https://github.com/robingenz/capacitor-firebase-plugin-demo)

## Starter templates[¶](#starter-templates "Permanent link")

The following starter templates are available:

* [Ionstarter Angular Firebase](https://ionstarter.dev/)

## Usage[¶](#usage "Permanent link")

The following examples show how to upload and download files, get a download URL, list files, read and update file metadata, delete files, and connect to the Cloud Storage emulator.

### Upload a file[¶](#upload-a-file "Permanent link")

Upload a file to Cloud Storage. On Android and iOS, provide the `uri` to the file to upload. On the Web, provide the data to upload as a `Blob` using the `blob` option instead. The callback is invoked with the upload progress and with `completed` set to `true` once the upload is finished:

`[](#%5F%5Fcodelineno-4-1)import { FirebaseStorage } from '@capacitor-firebase/storage';
[](#%5F%5Fcodelineno-4-2)
[](#%5F%5Fcodelineno-4-3)const uploadFile = async () => {
[](#%5F%5Fcodelineno-4-4)  return new Promise((resolve, reject) => {
[](#%5F%5Fcodelineno-4-5)    FirebaseStorage.uploadFile(
[](#%5F%5Fcodelineno-4-6)      {
[](#%5F%5Fcodelineno-4-7)        path: 'images/mountains.png',
[](#%5F%5Fcodelineno-4-8)        uri: 'file:///var/mobile/Containers/Data/Application/E397A70D-67E4-4258-236E-W1D9E12111D4/Library/Caches/092F8464-DE60-40B3-8A23-EB83160D9F9F/mountains.png',
[](#%5F%5Fcodelineno-4-9)      },
[](#%5F%5Fcodelineno-4-10)      (event, error) => {
[](#%5F%5Fcodelineno-4-11)        if (error) {
[](#%5F%5Fcodelineno-4-12)          reject(error);
[](#%5F%5Fcodelineno-4-13)        } else if (event?.completed) {
[](#%5F%5Fcodelineno-4-14)          resolve();
[](#%5F%5Fcodelineno-4-15)        }
[](#%5F%5Fcodelineno-4-16)      }
[](#%5F%5Fcodelineno-4-17)    );
[](#%5F%5Fcodelineno-4-18)  });
[](#%5F%5Fcodelineno-4-19)};
`

### Download a file[¶](#download-a-file "Permanent link")

Download a file from Cloud Storage. On Android and iOS, the file is downloaded to the local file system using the `uri` option. On the Web, the downloaded file is returned as a `Blob` in the callback event:

`[](#%5F%5Fcodelineno-5-1)import { FirebaseStorage } from '@capacitor-firebase/storage';
[](#%5F%5Fcodelineno-5-2)
[](#%5F%5Fcodelineno-5-3)const downloadFileWithFirebaseStorage = async () => {
[](#%5F%5Fcodelineno-5-4)  return new Promise((resolve, reject) => {
[](#%5F%5Fcodelineno-5-5)    FirebaseStorage.downloadFile(
[](#%5F%5Fcodelineno-5-6)      {
[](#%5F%5Fcodelineno-5-7)        path: 'images/mountains.png',
[](#%5F%5Fcodelineno-5-8)        uri: 'file:///var/mobile/Containers/Data/Application/E397A70D-67E4-4258-236E-W1D9E12111D4/Library/Caches/mountains.png', // Only available for Android and iOS
[](#%5F%5Fcodelineno-5-9)      },
[](#%5F%5Fcodelineno-5-10)      (event, error) => {
[](#%5F%5Fcodelineno-5-11)        if (error) {
[](#%5F%5Fcodelineno-5-12)          reject(error);
[](#%5F%5Fcodelineno-5-13)        } else if (event?.completed) {
[](#%5F%5Fcodelineno-5-14)          // On Web, the downloaded file is available as a Blob in event.blob
[](#%5F%5Fcodelineno-5-15)          resolve(event?.blob);
[](#%5F%5Fcodelineno-5-16)        }
[](#%5F%5Fcodelineno-5-17)      }
[](#%5F%5Fcodelineno-5-18)    );
[](#%5F%5Fcodelineno-5-19)  });
[](#%5F%5Fcodelineno-5-20)};
`

### Download a file with the Filesystem plugin[¶](#download-a-file-with-the-filesystem-plugin "Permanent link")

Alternatively, you can retrieve the download URL of the file and download it using the official [Capacitor Filesystem](https://capacitorjs.com/docs/apis/filesystem) plugin:

`[](#%5F%5Fcodelineno-6-1)import { FirebaseStorage } from '@capacitor-firebase/storage';
[](#%5F%5Fcodelineno-6-2)import { Filesystem, Directory } from '@capacitor/filesystem';
[](#%5F%5Fcodelineno-6-3)
[](#%5F%5Fcodelineno-6-4)const downloadFileWithFilesystem = async () => {
[](#%5F%5Fcodelineno-6-5)  const { downloadUrl } = await FirebaseStorage.getDownloadUrl({
[](#%5F%5Fcodelineno-6-6)    path: 'images/mountains.png',
[](#%5F%5Fcodelineno-6-7)  });
[](#%5F%5Fcodelineno-6-8)  const { path } = await Filesystem.downloadFile({
[](#%5F%5Fcodelineno-6-9)    url: downloadUrl,
[](#%5F%5Fcodelineno-6-10)    path: 'mountains.png',
[](#%5F%5Fcodelineno-6-11)    directory: Directory.Cache,
[](#%5F%5Fcodelineno-6-12)  });
[](#%5F%5Fcodelineno-6-13)  return path;
[](#%5F%5Fcodelineno-6-14)};
`

### Get a download URL[¶](#get-a-download-url "Permanent link")

Retrieve the download URL of a file, for example to display or share it:

`[](#%5F%5Fcodelineno-7-1)import { FirebaseStorage } from '@capacitor-firebase/storage';
[](#%5F%5Fcodelineno-7-2)
[](#%5F%5Fcodelineno-7-3)const getDownloadUrl = async () => {
[](#%5F%5Fcodelineno-7-4)  const { downloadUrl } = await FirebaseStorage.getDownloadUrl({
[](#%5F%5Fcodelineno-7-5)    path: 'images/mountains.png',
[](#%5F%5Fcodelineno-7-6)  });
[](#%5F%5Fcodelineno-7-7)  return downloadUrl;
[](#%5F%5Fcodelineno-7-8)};
`

### List files in a directory[¶](#list-files-in-a-directory "Permanent link")

List the files in a directory. Use the `maxResults` and `pageToken` options to paginate through large directories:

`[](#%5F%5Fcodelineno-8-1)import { FirebaseStorage } from '@capacitor-firebase/storage';
[](#%5F%5Fcodelineno-8-2)
[](#%5F%5Fcodelineno-8-3)const listFiles = async () => {
[](#%5F%5Fcodelineno-8-4)  const { items } = await FirebaseStorage.listFiles({
[](#%5F%5Fcodelineno-8-5)    path: 'images',
[](#%5F%5Fcodelineno-8-6)  });
[](#%5F%5Fcodelineno-8-7)  return items;
[](#%5F%5Fcodelineno-8-8)};
`

### Read and update file metadata[¶](#read-and-update-file-metadata "Permanent link")

Read the metadata of a file, such as its size, content type, and timestamps, or update it, including user-defined custom metadata:

`[](#%5F%5Fcodelineno-9-1)import { FirebaseStorage } from '@capacitor-firebase/storage';
[](#%5F%5Fcodelineno-9-2)
[](#%5F%5Fcodelineno-9-3)const getMetadata = async () => {
[](#%5F%5Fcodelineno-9-4)  const result = await FirebaseStorage.getMetadata({
[](#%5F%5Fcodelineno-9-5)    path: 'images/mountains.png',
[](#%5F%5Fcodelineno-9-6)  });
[](#%5F%5Fcodelineno-9-7)  return result;
[](#%5F%5Fcodelineno-9-8)};
[](#%5F%5Fcodelineno-9-9)
[](#%5F%5Fcodelineno-9-10)const updateMetadata = async () => {
[](#%5F%5Fcodelineno-9-11)  await FirebaseStorage.updateMetadata({
[](#%5F%5Fcodelineno-9-12)    path: 'images/mountains.png',
[](#%5F%5Fcodelineno-9-13)    metadata: {
[](#%5F%5Fcodelineno-9-14)      contentType: 'image/png',
[](#%5F%5Fcodelineno-9-15)      customMetadata: {
[](#%5F%5Fcodelineno-9-16)        foo: 'bar',
[](#%5F%5Fcodelineno-9-17)      },
[](#%5F%5Fcodelineno-9-18)    },
[](#%5F%5Fcodelineno-9-19)  });
[](#%5F%5Fcodelineno-9-20)};
`

### Delete a file[¶](#delete-a-file "Permanent link")

Delete a file from Cloud Storage:

`[](#%5F%5Fcodelineno-10-1)import { FirebaseStorage } from '@capacitor-firebase/storage';
[](#%5F%5Fcodelineno-10-2)
[](#%5F%5Fcodelineno-10-3)const deleteFile = async () => {
[](#%5F%5Fcodelineno-10-4)  await FirebaseStorage.deleteFile({
[](#%5F%5Fcodelineno-10-5)    path: 'images/mountains.png',
[](#%5F%5Fcodelineno-10-6)  });
[](#%5F%5Fcodelineno-10-7)};
`

### Use the Cloud Storage emulator[¶](#use-the-cloud-storage-emulator "Permanent link")

During development, you can instrument your app to talk to the local Cloud Storage emulator. When using an Android emulator device, `10.0.2.2` is the special IP address to connect to the `localhost` of the host computer. Note that on Android, the cleartext traffic must be allowed, which is not intended for use in production:

`[](#%5F%5Fcodelineno-11-1)import { FirebaseStorage } from '@capacitor-firebase/storage';
[](#%5F%5Fcodelineno-11-2)
[](#%5F%5Fcodelineno-11-3)const useEmulator = async () => {
[](#%5F%5Fcodelineno-11-4)  await FirebaseStorage.useEmulator({
[](#%5F%5Fcodelineno-11-5)    host: '10.0.2.2',
[](#%5F%5Fcodelineno-11-6)    port: 9001,
[](#%5F%5Fcodelineno-11-7)  });
[](#%5F%5Fcodelineno-11-8)};
`

## API[¶](#api "Permanent link")

* [deleteFile(...)](#deletefile)
* [getDownloadUrl(...)](#getdownloadurl)
* [getMetadata(...)](#getmetadata)
* [listFiles(...)](#listfiles)
* [updateMetadata(...)](#updatemetadata)
* [downloadFile(...)](#downloadfile)
* [uploadFile(...)](#uploadfile)
* [useEmulator(...)](#useemulator)
* [Interfaces](#interfaces)
* [Type Aliases](#type-aliases)

### deleteFile(...)[¶](#deletefile "Permanent link")

`[](#%5F%5Fcodelineno-12-1)deleteFile(options: DeleteFileOptions) => Promise<void>
`

Delete a file.

| Param       | Type                                    |
| ----------- | --------------------------------------- |
| **options** | [DeleteFileOptions](#deletefileoptions) |

**Since:** 5.3.0

---

### getDownloadUrl(...)[¶](#getdownloadurl "Permanent link")

`[](#%5F%5Fcodelineno-13-1)getDownloadUrl(options: GetDownloadUrlOptions) => Promise<GetDownloadUrlResult>
`

Get the download url for a file.

| Param       | Type                                            |
| ----------- | ----------------------------------------------- |
| **options** | [GetDownloadUrlOptions](#getdownloadurloptions) |

**Returns:** `Promise<[GetDownloadUrlResult](#getdownloadurlresult)>`

**Since:** 5.3.0

---

### getMetadata(...)[¶](#getmetadata "Permanent link")

`[](#%5F%5Fcodelineno-14-1)getMetadata(options: GetMetadataOptions) => Promise<GetMetadataResult>
`

Get the metadata for a file.

| Param       | Type                                      |
| ----------- | ----------------------------------------- |
| **options** | [GetMetadataOptions](#getmetadataoptions) |

**Returns:** `Promise<[GetMetadataResult](#getmetadataresult)>`

**Since:** 5.3.0

---

### listFiles(...)[¶](#listfiles "Permanent link")

`[](#%5F%5Fcodelineno-15-1)listFiles(options: ListFilesOptions) => Promise<ListFilesResult>
`

List files in a directory.

| Param       | Type                                  |
| ----------- | ------------------------------------- |
| **options** | [ListFilesOptions](#listfilesoptions) |

**Returns:** `Promise<[ListFilesResult](#listfilesresult)>`

**Since:** 5.3.0

---

### updateMetadata(...)[¶](#updatemetadata "Permanent link")

`[](#%5F%5Fcodelineno-16-1)updateMetadata(options: UpdateMetadataOptions) => Promise<void>
`

Update the metadata for a file.

| Param       | Type                                            |
| ----------- | ----------------------------------------------- |
| **options** | [UpdateMetadataOptions](#updatemetadataoptions) |

**Since:** 5.3.0

---

### downloadFile(...)[¶](#downloadfile "Permanent link")

`[](#%5F%5Fcodelineno-17-1)downloadFile(options: DownloadFileOptions, callback: DownloadFileCallback) => Promise<CallbackId>
`

Download a file.

On **Android** and **iOS**, the file is downloaded to the local file system using the `uri` option.

On **Web**, the file is downloaded as a `Blob` and returned in the callback event.

| Param        | Type                                          |
| ------------ | --------------------------------------------- |
| **options**  | [DownloadFileOptions](#downloadfileoptions)   |
| **callback** | [DownloadFileCallback](#downloadfilecallback) |

**Returns:** `Promise<string>`

**Since:** 8.2.0

---

### uploadFile(...)[¶](#uploadfile "Permanent link")

`[](#%5F%5Fcodelineno-18-1)uploadFile(options: UploadFileOptions, callback: UploadFileCallback) => Promise<CallbackId>
`

Upload a file.

| Param        | Type                                      |
| ------------ | ----------------------------------------- |
| **options**  | [UploadFileOptions](#uploadfileoptions)   |
| **callback** | [UploadFileCallback](#uploadfilecallback) |

**Returns:** `Promise<string>`

**Since:** 5.3.0

---

### useEmulator(...)[¶](#useemulator "Permanent link")

`[](#%5F%5Fcodelineno-19-1)useEmulator(options: UseEmulatorOptions) => Promise<void>
`

Instrument your app to talk to the Cloud Storage emulator.

On Android, the cleartext traffic must be allowed. On the Capacitor configuration: 

`[](#%5F%5Fcodelineno-20-1){
[](#%5F%5Fcodelineno-20-2)  server: {
[](#%5F%5Fcodelineno-20-3)    cleartext: true
[](#%5F%5Fcodelineno-20-4)  }
[](#%5F%5Fcodelineno-20-5)}
`

**The cleartext traffic is not intended for use in production.** 

| Param       | Type                                      |
| ----------- | ----------------------------------------- |
| **options** | [UseEmulatorOptions](#useemulatoroptions) |

**Since:** 6.1.0

---

### Interfaces[¶](#interfaces "Permanent link")

#### DeleteFileOptions[¶](#deletefileoptions "Permanent link")

| Prop     | Type   | Description                                                   | Since |
| -------- | ------ | ------------------------------------------------------------- | ----- |
| **path** | string | The full path to the file to delete, including the file name. | 5.3.0 |

#### GetDownloadUrlResult[¶](#getdownloadurlresult "Permanent link")

| Prop            | Type   | Description                    | Since |
| --------------- | ------ | ------------------------------ | ----- |
| **downloadUrl** | string | The download url for the file. | 5.3.0 |

#### GetDownloadUrlOptions[¶](#getdownloadurloptions "Permanent link")

| Prop     | Type   | Description                                                                     | Since |
| -------- | ------ | ------------------------------------------------------------------------------- | ----- |
| **path** | string | The full path to the file to get the download url for, including the file name. | 5.3.0 |

#### GetMetadataResult[¶](#getmetadataresult "Permanent link")

| Prop                   | Type                         | Description                                                                       | Since |
| ---------------------- | ---------------------------- | --------------------------------------------------------------------------------- | ----- |
| **bucket**             | string                       | The bucket this file is contained in.                                             | 5.3.0 |
| **createdAt**          | number                       | The timestamp at which the file was created in milliseconds since the epoch.      | 5.3.0 |
| **generation**         | string                       | The object's generation.                                                          | 5.3.0 |
| **md5Hash**            | string                       | The md5 hash of the file.                                                         | 5.3.0 |
| **metadataGeneration** | string                       | The object's metadata generation.                                                 | 5.3.0 |
| **name**               | string                       | The short name of this file, which is the last component of the full path.        | 5.3.0 |
| **path**               | string                       | The full path to the file, including the file name.                               | 5.3.0 |
| **size**               | number                       | The size of the file in bytes.                                                    | 5.3.0 |
| **updatedAt**          | number                       | The timestamp at which the file was last updated in milliseconds since the epoch. | 5.3.0 |
| **cacheControl**       | string                       | Served as the Cache-Control header on object download.                            | 6.1.0 |
| **contentDisposition** | string                       | Served as the Content-Disposition header on object download.                      | 6.1.0 |
| **contentEncoding**    | string                       | Served as the Content-Encoding header on object download.                         | 6.1.0 |
| **contentLanguage**    | string                       | Served as the Content-Language header on object download.                         | 6.1.0 |
| **contentType**        | string                       | Served as the Content-Type header on object download.                             | 6.1.0 |
| **customMetadata**     | { \[key: string\]: string; } | Additional user-defined custom metadata.                                          | 6.1.0 |

#### GetMetadataOptions[¶](#getmetadataoptions "Permanent link")

| Prop     | Type   | Description                                                                 | Since |
| -------- | ------ | --------------------------------------------------------------------------- | ----- |
| **path** | string | The full path to the file to get the metadata for, including the file name. | 5.3.0 |

#### ListFilesResult[¶](#listfilesresult "Permanent link")

| Prop              | Type                 | Description                                                                           | Since |
| ----------------- | -------------------- | ------------------------------------------------------------------------------------- | ----- |
| **items**         | StorageReference\[\] | The list of files in the directory.                                                   | 5.3.0 |
| **nextPageToken** | string               | If set, there might be more results for this list. Use this token to resume the list. | 5.3.0 |

#### StorageReference[¶](#storagereference "Permanent link")

| Prop       | Type   | Description                                                                | Since |
| ---------- | ------ | -------------------------------------------------------------------------- | ----- |
| **bucket** | string | The bucket this file is contained in.                                      | 5.3.0 |
| **path**   | string | The full path to the file, including the file name.                        | 5.3.0 |
| **name**   | string | The short name of this file, which is the last component of the full path. | 5.3.0 |

#### ListFilesOptions[¶](#listfilesoptions "Permanent link")

| Prop           | Type   | Description                                                                                                             | Default | Since |
| -------------- | ------ | ----------------------------------------------------------------------------------------------------------------------- | ------- | ----- |
| **path**       | string | The full path to the directory to list files for.                                                                       |         | 5.3.0 |
| **maxResults** | number | The maximum number of results to return.                                                                                | 1000    | 5.3.0 |
| **pageToken**  | string | The page token, returned by a previous call to this method. If provided, listing is resumed from the previous position. |         | 5.3.0 |

#### UpdateMetadataOptions[¶](#updatemetadataoptions "Permanent link")

| Prop         | Type                                  | Description                                                                    | Since |
| ------------ | ------------------------------------- | ------------------------------------------------------------------------------ | ----- |
| **path**     | string                                | The full path to the file to update the metadata for, including the file name. | 5.3.0 |
| **metadata** | [SettableMetadata](#settablemetadata) | The metadata to update.                                                        | 5.3.0 |

#### SettableMetadata[¶](#settablemetadata "Permanent link")

| Prop                   | Type                         | Description                                                  | Since |
| ---------------------- | ---------------------------- | ------------------------------------------------------------ | ----- |
| **cacheControl**       | string                       | Served as the Cache-Control header on object download.       | 5.3.0 |
| **contentDisposition** | string                       | Served as the Content-Disposition header on object download. | 5.3.0 |
| **contentEncoding**    | string                       | Served as the Content-Encoding header on object download.    | 5.3.0 |
| **contentLanguage**    | string                       | Served as the Content-Language header on object download.    | 5.3.0 |
| **contentType**        | string                       | Served as the Content-Type header on object download.        | 5.3.0 |
| **customMetadata**     | { \[key: string\]: string; } | Additional user-defined custom metadata.                     | 5.3.0 |

#### DownloadFileOptions[¶](#downloadfileoptions "Permanent link")

| Prop     | Type   | Description                                                          | Since |
| -------- | ------ | -------------------------------------------------------------------- | ----- |
| **path** | string | The full path to the file to download, including the file name.      | 8.2.0 |
| **uri**  | string | The uri to download the file to. Only available for Android and iOS. | 8.2.0 |

#### DownloadFileCallbackEvent[¶](#downloadfilecallbackevent "Permanent link")

| Prop                 | Type    | Description                                                                         | Since |
| -------------------- | ------- | ----------------------------------------------------------------------------------- | ----- |
| **progress**         | number  | The download progress, as a percentage between 0 and 1.                             | 8.2.0 |
| **bytesTransferred** | number  | The number of bytes that have been transferred. Only available for Android and Web. | 8.2.0 |
| **totalBytes**       | number  | The total number of bytes to be transferred. Only available for Android and Web.    | 8.2.0 |
| **completed**        | boolean | Whether the download is completed or not.                                           | 8.2.0 |
| **blob**             | Blob    | The downloaded file as a Blob. Only available for Web.                              | 8.2.0 |

#### UploadFileOptions[¶](#uploadfileoptions "Permanent link")

| Prop         | Type                              | Description                                                           | Since |
| ------------ | --------------------------------- | --------------------------------------------------------------------- | ----- |
| **blob**     | Blob                              | The data to upload. Only available for Web.                           | 5.3.0 |
| **path**     | string                            | The full path where data should be uploaded, including the file name. | 5.3.0 |
| **uri**      | string                            | The uri to the file to upload. Only available for Android and iOS.    | 5.3.0 |
| **metadata** | [UploadMetadata](#uploadmetadata) | The metadata to set for the file.                                     | 5.4.0 |

#### UploadMetadata[¶](#uploadmetadata "Permanent link")

| Prop        | Type   | Description                                                      | Since |
| ----------- | ------ | ---------------------------------------------------------------- | ----- |
| **md5Hash** | string | The base64-encoded MD5 hash of the file. Only available for Web. | 5.4.0 |

#### UploadFileCallbackEvent[¶](#uploadfilecallbackevent "Permanent link")

| Prop                 | Type    | Description                                                                         | Since |
| -------------------- | ------- | ----------------------------------------------------------------------------------- | ----- |
| **progress**         | number  | The upload progress, as a percentage between 0 and 1.                               | 5.3.0 |
| **bytesTransferred** | number  | The number of bytes that have been transferred. Only available for Android and Web. | 5.3.0 |
| **totalBytes**       | number  | The total number of bytes to be transferred. Only available for Android and Web.    | 5.3.0 |
| **completed**        | boolean | Whether the upload is completed or not.                                             | 5.3.0 |

#### UseEmulatorOptions[¶](#useemulatoroptions "Permanent link")

| Prop     | Type   | Description                                                                                                                                                                     | Default | Since |
| -------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | ----- |
| **host** | string | The emulator host without any port or scheme. Note when using a Android Emulator device: 10.0.2.2 is the special IP address to connect to the 'localhost' of the host computer. |         | 6.1.0 |
| **port** | number | The emulator port.                                                                                                                                                              | 9199    | 6.1.0 |

### Type Aliases[¶](#type-aliases "Permanent link")

#### DownloadFileCallback[¶](#downloadfilecallback "Permanent link")

`(event: [DownloadFileCallbackEvent](#downloadfilecallbackevent) | null, error: any): void`

#### CallbackId[¶](#callbackid "Permanent link")

`string`

#### UploadFileCallback[¶](#uploadfilecallback "Permanent link")

`(event: [UploadFileCallbackEvent](#uploadfilecallbackevent) | null, error: any): void`

## FAQ[¶](#faq "Permanent link")

### How do I track the progress of an upload or download?[¶](#how-do-i-track-the-progress-of-an-upload-or-download "Permanent link")

The `uploadFile(...)` and `downloadFile(...)` methods accept a callback that is invoked with events containing the `progress` as a fraction between 0 and 1 and a `completed` flag. The `bytesTransferred` and `totalBytes` properties are only available on Android and Web.

### How does downloading a file differ between the platforms?[¶](#how-does-downloading-a-file-differ-between-the-platforms "Permanent link")

On Android and iOS, the file is downloaded to the local file system using the `uri` option. On the Web, the downloaded file is returned as a `Blob` in the callback event. Alternatively, you can retrieve the download URL with `getDownloadUrl(...)` and download the file with the official Capacitor Filesystem plugin, as shown in the [usage example](#download-a-file-with-the-filesystem-plugin) above.

### How do I upload a file selected by the user?[¶](#how-do-i-upload-a-file-selected-by-the-user "Permanent link")

On Android and iOS, pass the `uri` of the file to the `uploadFile(...)` method. On the Web, pass the data as a `Blob` using the `blob` option instead. You can use the [File Picker](https://capawesome.io/docs/sdks/capacitor/file-picker/) plugin to let the user select a file on the device.

### How can I store additional information about a file?[¶](#how-can-i-store-additional-information-about-a-file "Permanent link")

You can set metadata for a file when uploading it using the `metadata` option or update it later with `updateMetadata(...)`, including user-defined key-value pairs via `customMetadata`. Use `getMetadata(...)` to read the metadata of a file, such as its size, content type, and timestamps.

### Can I test against the Cloud Storage emulator?[¶](#can-i-test-against-the-cloud-storage-emulator "Permanent link")

Yes, use the `useEmulator(...)` method to instrument your app to talk to the local Cloud Storage emulator, as shown in the [usage example](#use-the-cloud-storage-emulator) above. When testing on an Android emulator device, use `10.0.2.2` as the host to reach the `localhost` of the host computer. Keep in mind that on Android, the cleartext traffic must be allowed for this, which is not intended for use in production.

## Related Plugins[¶](#related-plugins "Permanent link")

* [File Picker](https://capawesome.io/docs/sdks/capacitor/file-picker/): Let the user select a file, directory, image, or video from the device.
* [File Compressor](https://capawesome.io/docs/sdks/capacitor/file-compressor/): Compress files such as PNG, JPEG, and WebP images before uploading them.
* [Firebase Cloud Firestore](https://capawesome.io/docs/sdks/capacitor/firebase/cloud-firestore/): Store and sync app data in Cloud Firestore.

## Newsletter[¶](#newsletter "Permanent link")

Stay up to date with the latest news and updates about the Capawesome, Capacitor, and Ionic ecosystem by subscribing to our [Capawesome Newsletter](https://cloud.capawesome.io/newsletter/).

## Changelog[¶](#changelog "Permanent link")

See [CHANGELOG.md](https://github.com/capawesome-team/capacitor-firebase/blob/main/packages/storage/CHANGELOG.md).

## License[¶](#license "Permanent link")

See [LICENSE](https://github.com/capawesome-team/capacitor-firebase/blob/main/packages/storage/LICENSE).

---

1. This project is not affiliated with, endorsed by, sponsored by, or approved by Google LLC or any of their affiliates or subsidiaries. [↩](#fnref:1 "Jump back to footnote 1 in the text")

July 8, 2026 

Back to top

```json
{"@context": "https://schema.org", "@graph": [{"@type": "TechArticle", "@id": "https://capawesome.io/docs/sdks/capacitor/firebase/cloud-storage/#article", "headline": "Capacitor Firebase Storage Plugin for Android, iOS & Web", "name": "Capacitor Firebase Storage Plugin for Android, iOS & Web", "description": "Unofficial Capacitor plugin for Firebase Cloud Storage SDK to upload and download files in your app.", "inLanguage": "en", "url": "https://capawesome.io/docs/sdks/capacitor/firebase/cloud-storage/", "mainEntityOfPage": "https://capawesome.io/docs/sdks/capacitor/firebase/cloud-storage/", "author": {"@type": "Organization", "name": "Capawesome", "url": "https://capawesome.io", "logo": {"@type": "ImageObject", "url": "https://capawesome.io/assets/images/logo.svg"}}, "publisher": {"@type": "Organization", "name": "Capawesome", "url": "https://capawesome.io", "logo": {"@type": "ImageObject", "url": "https://capawesome.io/assets/images/logo.svg"}}, "about": {"@id": "https://capawesome.io/docs/sdks/capacitor/firebase/cloud-storage/#software"}}, {"@type": "SoftwareSourceCode", "@id": "https://capawesome.io/docs/sdks/capacitor/firebase/cloud-storage/#software", "name": "Capacitor Firebase Storage Plugin for Android, iOS & Web", "description": "Unofficial Capacitor plugin for Firebase Cloud Storage SDK to upload and download files in your app.", "url": "https://capawesome.io/docs/sdks/capacitor/firebase/cloud-storage/", "programmingLanguage": "TypeScript", "runtimePlatform": "Capacitor", "codeRepository": "https://github.com/capawesome-team", "author": {"@type": "Organization", "name": "Capawesome", "url": "https://capawesome.io", "logo": {"@type": "ImageObject", "url": "https://capawesome.io/assets/images/logo.svg"}}, "publisher": {"@type": "Organization", "name": "Capawesome", "url": "https://capawesome.io", "logo": {"@type": "ImageObject", "url": "https://capawesome.io/assets/images/logo.svg"}}}]}
{"@context": "https://schema.org", "@type": "FAQPage", "mainEntity": [{"@type": "Question", "name": "How do I track the progress of an upload or download?", "acceptedAnswer": {"@type": "Answer", "text": "The uploadFile(...) and downloadFile(...) methods accept a callback that is invoked with events containing the progress as a fraction between 0 and 1 and a completed flag. The bytesTransferred and totalBytes properties are only available on Android and Web."}}, {"@type": "Question", "name": "How does downloading a file differ between the platforms?", "acceptedAnswer": {"@type": "Answer", "text": "On Android and iOS, the file is downloaded to the local file system using the uri option. On the Web, the downloaded file is returned as a Blob in the callback event. Alternatively, you can retrieve the download URL with getDownloadUrl(...) and download the file with the official Capacitor Filesystem plugin, as shown in the usage example above."}}, {"@type": "Question", "name": "How do I upload a file selected by the user?", "acceptedAnswer": {"@type": "Answer", "text": "On Android and iOS, pass the uri of the file to the uploadFile(...) method. On the Web, pass the data as a Blob using the blob option instead. You can use the File Picker plugin to let the user select a file on the device."}}, {"@type": "Question", "name": "How can I store additional information about a file?", "acceptedAnswer": {"@type": "Answer", "text": "You can set metadata for a file when uploading it using the metadata option or update it later with updateMetadata(...), including user-defined key-value pairs via customMetadata. Use getMetadata(...) to read the metadata of a file, such as its size, content type, and timestamps."}}, {"@type": "Question", "name": "Can I test against the Cloud Storage emulator?", "acceptedAnswer": {"@type": "Answer", "text": "Yes, use the useEmulator(...) method to instrument your app to talk to the local Cloud Storage emulator, as shown in the usage example above. When testing on an Android emulator device, use 10.0.2.2 as the host to reach the localhost of the host computer. Keep in mind that on Android, the cleartext traffic must be allowed for this, which is not intended for use in production."}}], "url": "https://capawesome.io/docs/sdks/capacitor/firebase/cloud-storage/"}
```
