firebase-admin.storage package

Cloud Storage for Firebase.

Functions

FunctionDescription
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

ClassDescription
Storage_2The 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

ParameterTypeDescription
fileFile

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

ParameterTypeDescription
appApp

Returns:

Storage

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.