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.
// 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's Storage service or as getStorage(app) to access the Storage service associated with a specific app.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["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);"]]