Cloud Storage for Firebase.
Functions
Function | Description |
---|---|
getDownloadURL(file) | Gets the download URL for the given File. |
getStorage(app) | Gets the Storage service for the default app or a given app.getStorage() can be called with no arguments to access the default app's Storage service or as getStorage(app) to access the Storage service associated with a specific app. |
Classes
Class | Description |
---|---|
Storage | The default Storage service if no app is provided or the Storage service associated with the provided app. |
getDownloadURL(file)
Gets the download URL for the given File.
Signature:
export declare function getDownloadURL(file: File): Promise<string>;
Parameters
Parameter | Type | Description |
---|---|---|
file | File |
Returns:
Promise<string>
Example
// Get the downloadUrl for a given file ref
const storage = getStorage();
const myRef = ref(storage, 'images/mountains.jpg');
const downloadUrl = await getDownloadURL(myRef);
getStorage(app)
Gets the Storage service for the default app or a given app.
getStorage()
can be called with no arguments to access the default app's Storage
service or as getStorage(app)
to access the Storage
service associated with a specific app.
Signature:
export declare function getStorage(app?: App): Storage;
Parameters
Parameter | Type | Description |
---|---|---|
app | App |
Returns:
Example 1
// Get the Storage service for the default app
const defaultStorage = getStorage();
Example 2
// Get the Storage service for a given app
const otherStorage = getStorage(otherApp);