Expand description
§Firebase Storage module.
This module ports core pieces of the Firebase Storage Web SDK to Rust so applications
can discover buckets, navigate object paths, and perform common download, metadata,
and upload operations in a synchronous, reqwest-powered environment.
It provides functionality to interact with Firebase Storage, including uploading and downloading files, managing metadata, and handling storage references.
It includes error handling, configuration options, and integration with Firebase apps.
§Features
- Connect to Firebase Storage emulator
- Get storage instance for a Firebase app
- Register storage component
- Manage storage references
- Handle file uploads with progress tracking
- List files and directories in storage
- Manage object metadata
- Comprehensive error handling
§References to the Firebase JS SDK - storage module
- QuickStart: https://firebase.google.com/docs/storage/web/start
- API: https://firebase.google.com/docs/reference/js/storage.md#storage_package
- Github Repo - Module: https://github.com/firebase/firebase-js-sdk/tree/main/packages/storage
- Github Repo - API: https://github.com/firebase/firebase-js-sdk/tree/main/packages/firebase/storage
§Development status as of 14th October 2025
- Core functionalities: Mostly implemented (see the module’s README for details)
- Tests: 27 tests (passed)
- Documentation: Lacking documentation on most functions
- Examples: None provided
DISCLAIMER: This is not an official Firebase product, nor it is guaranteed that it has no bugs or that it will work as intended.
§Example
use firebase_rs_sdk::app::*;
use firebase_rs_sdk::storage::*;
fn main() {
let options = FirebaseOptions {
storage_bucket: Some("BUCKET_NAME".into()),
..Default::default()
};
let app = initialize_app(options, Some(FirebaseAppSettings::default()))
.expect("failed to initialize app");
let storage = get_storage_for_app(Some(app), None)
.expect("storage component not available");
let photos = storage
.root_reference()
.expect("missing default bucket")
.child("photos");
// Upload a photo; small payloads are sent via multipart upload while larger blobs use the resumable API.
let image_bytes = vec![/* PNG bytes */];
let mut upload_metadata = UploadMetadata::new().with_content_type("image/png");
upload_metadata.insert_custom_metadata("uploaded-by", "quickstart");
let metadata = photos
.child("welcome.png")
.upload_bytes(image_bytes, Some(upload_metadata))
.expect("upload failed");
println!("Uploaded {} to bucket {}", metadata.name.unwrap_or_default(), metadata.bucket.unwrap_or_default());
// List the directory and stream the first few kilobytes of each item.
let listing = photos.list_all().expect("failed to list objects");
for object in listing.items {
let url = object.get_download_url().expect("missing download URL");
let bytes = object
.get_bytes(Some(256 * 1024))
.expect("download limited to 256 KiB");
println!("{} -> {} bytes", url, bytes.len());
}
}Modules§
Structs§
- Backoff
Config - Configuration for exponential backoff when issuing storage requests.
- Backoff
State - Tracks the evolving backoff state across attempts.
- Firebase
Storage Impl - Http
Client - List
Options - List
Result - Location
- Object
Metadata - Request
Info - Response
Payload - Resumable
Upload Status - SetMetadata
Request - Storage
Error - Storage
Reference - Upload
Progress - Progress information emitted while uploading large blobs.
- Upload
Task - Stateful helper that mirrors the Firebase Web SDK’s resumable upload behaviour.
Enums§
- Request
Body - Request
Error - Storage
Error Code - Upload
Task State - Represents the execution state of an
UploadTask.
Constants§
- DEFAULT_
HOST - DEFAULT_
MAX_ OPERATION_ RETRY_ TIME_ MS - DEFAULT_
MAX_ UPLOAD_ RETRY_ TIME_ MS - DEFAULT_
PROTOCOL - RESUMABLE_
UPLOAD_ CHUNK_ SIZE - STORAGE_
TYPE
Functions§
- build_
list_ options - child
- connect_
storage_ emulator - continue_
resumable_ upload_ request - create_
resumable_ upload_ request - delete_
object_ request - delete_
storage_ instance - download_
bytes_ request - download_
url_ request - get_
metadata_ request - get_
resumable_ upload_ status_ request - get_
storage_ for_ app - is_
retry_ status_ code - is_url
- last_
component - list_
request - multipart_
upload_ request - parent
- parse_
list_ result - register_
storage_ component - storage_
ref_ from_ reference - storage_
ref_ from_ storage - update_
metadata_ request