Cloud Storage for Firebase。
函数
函数 | 说明 |
---|---|
getDownload网址(file) | 获取指定文件 的下载网址。 |
getStorage(应用) | 获取默认应用或指定应用的 Storage 服务。可以不使用任何参数调用 getStorage() 以访问默认应用的 Storage 服务,或者以 getStorage(app) 的形式调用 getStorage() 以访问与特定应用关联的 Storage 服务。 |
类
类 | 说明 |
---|---|
存储 | 如果未提供应用,或与提供的应用关联的 Storage 服务,则为默认的 Storage 服务。 |
getDownload网址(file)
获取指定文件 的下载网址。
签名:
export declare function getDownloadURL(file: File): Promise<string>;
参数
参数 | 类型 | 说明 |
---|---|---|
文件 | 文件 |
返回:
Promise<string>
示例
// 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 服务。
可以不使用任何参数调用 getStorage()
,以访问默认应用的 Storage
服务,或者以 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);