Skip to content

feat(storage): add downloadFile method#965

Merged
robingenz merged 4 commits intomainfrom
feat/issue-665
Mar 30, 2026
Merged

feat(storage): add downloadFile method#965
robingenz merged 4 commits intomainfrom
feat/issue-665

Conversation

@robingenz
Copy link
Copy Markdown
Member

Summary

  • Add downloadFile method to the Cloud Storage plugin that downloads files directly from Firebase Storage without generating a public download URL
  • 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 using Firebase's getBlob and returned in the callback event
  • Supports progress tracking via callbacks (same pattern as uploadFile)

Close #665

Copilot AI review requested due to automatic review settings March 30, 2026 15:18
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new downloadFile API to the Storage plugin to download protected files without generating a public download URL, using platform-appropriate mechanisms (native file download on Android/iOS; Blob download on Web).

Changes:

  • Added downloadFile(options, callback) to the public plugin interface and docs.
  • Implemented Web download via Firebase Storage getBlob, returning the Blob via callback.
  • Implemented native downloads: Android uses StorageReference.getFile(uri); iOS uses StorageReference.write(toFile:), both emitting progress callbacks.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/storage/src/web.ts Adds Web implementation of downloadFile using getBlob.
packages/storage/src/definitions.ts Extends public API with downloadFile types/options/callback events.
packages/storage/ios/Plugin/FirebaseStoragePlugin.swift Exposes downloadFile as a callback-style Capacitor method on iOS.
packages/storage/ios/Plugin/FirebaseStorage.swift Implements iOS download using write(toFile:) with progress/success/failure observers.
packages/storage/ios/Plugin/Classes/Options/DownloadFileOptions.swift Adds iOS options container for downloadFile.
packages/storage/ios/Plugin/Classes/Events/DownloadFileCallbackEvent.swift Adds iOS callback event serialization for progress/completion.
packages/storage/android/src/main/java/.../FirebaseStoragePlugin.java Exposes downloadFile as a callback-style Capacitor method on Android.
packages/storage/android/src/main/java/.../FirebaseStorage.java Implements Android download using getFile(uri) with progress/success/failure listeners.
packages/storage/android/src/main/java/.../classes/options/DownloadFileOptions.java Adds Android options container for downloadFile.
packages/storage/android/src/main/java/.../classes/events/DownloadFileCallbackEvent.java Adds Android callback event serialization including bytes/progress.
packages/storage/android/src/main/java/.../enums/DownloadFileState.java Adds Android state enum to compute completed.
packages/storage/README.md Documents the new downloadFile API and related types.
.changeset/brave-dogs-cheer.md Declares a minor bump for the new feature.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 30, 2026

Open in StackBlitz

@capacitor-firebase/analytics

npm i https://pkg.pr.new/capawesome-team/capacitor-firebase/@capacitor-firebase/analytics@965

@capacitor-firebase/app

npm i https://pkg.pr.new/capawesome-team/capacitor-firebase/@capacitor-firebase/app@965

@capacitor-firebase/app-check

npm i https://pkg.pr.new/capawesome-team/capacitor-firebase/@capacitor-firebase/app-check@965

@capacitor-firebase/authentication

npm i https://pkg.pr.new/capawesome-team/capacitor-firebase/@capacitor-firebase/authentication@965

@capacitor-firebase/crashlytics

npm i https://pkg.pr.new/capawesome-team/capacitor-firebase/@capacitor-firebase/crashlytics@965

@capacitor-firebase/firestore

npm i https://pkg.pr.new/capawesome-team/capacitor-firebase/@capacitor-firebase/firestore@965

@capacitor-firebase/functions

npm i https://pkg.pr.new/capawesome-team/capacitor-firebase/@capacitor-firebase/functions@965

@capacitor-firebase/messaging

npm i https://pkg.pr.new/capawesome-team/capacitor-firebase/@capacitor-firebase/messaging@965

@capacitor-firebase/performance

npm i https://pkg.pr.new/capawesome-team/capacitor-firebase/@capacitor-firebase/performance@965

@capacitor-firebase/remote-config

npm i https://pkg.pr.new/capawesome-team/capacitor-firebase/@capacitor-firebase/remote-config@965

@capacitor-firebase/storage

npm i https://pkg.pr.new/capawesome-team/capacitor-firebase/@capacitor-firebase/storage@965

commit: 6d0f2b0

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@robingenz robingenz merged commit efa5b6f into main Mar 30, 2026
10 checks passed
@robingenz robingenz deleted the feat/issue-665 branch March 30, 2026 16:22
@github-actions github-actions bot mentioned this pull request Mar 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(storage): add the getBlob and downloadFile methods

2 participants