firebase-admin.storage package Stay organized with collections Save and categorize content based on your preferences.
Cloud Storage for Firebase.
Functions
| Function | Description |
|---|---|
| getDownloadURL(file) | Gets the download URL for the givenFile. |
| getStorage(app) | Gets the service for the default app or a given app.getStorage() can be called with no arguments to access the default app'sStorage service or asgetStorage(app) to access theStorage service associated with a specific app. |
Classes
| Class | Description |
|---|---|
| Storage_2 | The defaultStorage service if no app is provided or theStorage service associated with the provided app. |
getDownloadURL(file)
Gets the download URL for the givenFile.
Signature:
exportdeclarefunctiongetDownloadURL(file:File):Promise<string>;Parameters
| Parameter | Type | Description |
|---|---|---|
| file | File |
Returns:
Promise<string>
Example
// Get the downloadUrl for a given file refconststorage=getStorage();constmyRef=ref(storage,'images/mountains.jpg');constdownloadUrl=awaitgetDownloadURL(myRef);getStorage(app)
Gets the service for the default app or a given app.
getStorage() can be called with no arguments to access the default app'sStorage service or asgetStorage(app) to access theStorage service associated with a specific app.
Signature:
exportdeclarefunctiongetStorage(app?:App):Storage;Parameters
| Parameter | Type | Description |
|---|---|---|
| app | App |
Returns:
Example 1
// Get the Storage service for the default appconstdefaultStorage=getStorage();Example 2
// Get the Storage service for a given appconstotherStorage=getStorage(otherApp);Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-11-12 UTC.