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 given File. |
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's Storage service or as getStorage(app) to access the Storage service associated with a specific app. |
Classes
Class |
Description |
Storage_2 |
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 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:
Storage
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);
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-11-12 UTC.
[null,null,["Last updated 2024-11-12 UTC."],[],[],null,["# firebase-admin.storage package\n\nCloud Storage for Firebase.\n\nFunctions\n---------\n\n| Function | Description |\n|----------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [getDownloadURL(file)](./firebase-admin.storage.md#getdownloadurl_bc488a6) | Gets the download URL for the given [File](https://cloud.google.com/nodejs/docs/reference/storage/latest/storage/file). |\n| [getStorage(app)](./firebase-admin.storage.md#getstorage_8a40afc) | Gets the 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. |\n\nClasses\n-------\n\n| Class | Description |\n|--------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------|\n| [Storage_2](./firebase-admin.storage.storage_2.md#storage_2_class) | The default `Storage` service if no app is provided or the `Storage` service associated with the provided app. |\n\ngetDownloadURL(file)\n--------------------\n\nGets the download URL for the given [File](https://cloud.google.com/nodejs/docs/reference/storage/latest/storage/file).\n\n**Signature:** \n\n export declare function getDownloadURL(file: File): Promise\u003cstring\u003e;\n\n### Parameters\n\n| Parameter | Type | Description |\n|-----------|------|-------------|\n| file | File | |\n\n**Returns:**\n\nPromise\\\u003cstring\\\u003e\n\n### Example\n\n // Get the downloadUrl for a given file ref\n const storage = getStorage();\n const myRef = ref(storage, 'images/mountains.jpg');\n const downloadUrl = await getDownloadURL(myRef);\n\ngetStorage(app)\n---------------\n\nGets the service for the default app or a given app.\n\n`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.\n\n**Signature:** \n\n export declare function getStorage(app?: App): Storage;\n\n### Parameters\n\n| Parameter | Type | Description |\n|-----------|------|-------------|\n| app | App | |\n\n**Returns:**\n\n[Storage](./firebase-admin.storage.storage_2.md#storage_2_class)\n\n### Example 1\n\n // Get the Storage service for the default app\n const defaultStorage = getStorage();\n\n### Example 2\n\n // Get the Storage service for a given app\n const otherStorage = getStorage(otherApp);"]]