firebase-admin.storage package

Cloud Storage for Firebase

関数

関数 説明
getDownloadURL(ファイル) 指定された File のダウンロード URL を取得します。
getStorage(アプリ) デフォルト アプリまたは特定のアプリの Storage サービスを取得します。引数なしで getStorage() を呼び出してデフォルト アプリの Storage サービスにアクセスするか、getStorage(app) として呼び出して、特定のアプリに関連付けられている Storage サービスにアクセスできます。

クラス

クラス 説明
ストレージ アプリが指定されていない場合は、デフォルトの Storage サービス、または指定されたアプリに関連付けられている Storage サービス。

getDownloadURL(ファイル)

指定された File のダウンロード URL を取得します。

署名:

export declare function getDownloadURL(file: File): Promise<string>;

パラメータ

パラメータ 説明
あなた宛てに表示されます。 File

戻り値:

Promise<文字列>

// Get the downloadUrl for a given file ref
const storage = getStorage();
const myRef = ref(storage, 'images/mountains.jpg');
const downloadUrl = await getDownloadURL(myRef);

getStorage(アプリ)

デフォルト アプリまたは指定されたアプリの Storage サービスを取得します。

デフォルト アプリの Storage サービスにアクセスするには、引数なしで getStorage() を呼び出すか、getStorage(app) として呼び出して特定のアプリに関連付けられている Storage サービスにアクセスします。

署名:

export declare function getStorage(app?: App): Storage;

パラメータ

パラメータ 説明
app アプリ

戻り値:

ストレージ

例 1

// Get the Storage service for the default app
const defaultStorage = getStorage();

例 2

// Get the Storage service for a given app
const otherStorage = getStorage(otherApp);