目录

StorageReference

Interface Info

export interface StorageReference

云端文件的引用,提供对象的列举、上传、下载、删除、元数据更新等各项操作的封装。

Property Summary

Name

Type

Description

bucket

string

文件存储在云端的存储实例名称。

path

string

文件存储在云端的路径信息。

name

string

文件存储在云端的文件名称。

parent

StorageReference | null

文件存储在云端的父目录的StorageReference引用。当文件本身存储在根路径时,父目录引用为null。

root

StorageReference

文件存储在云端的根目录的StorageReference引用。

storage

StorageManagement

文件存储在云端管理类的StorageManagement引用。

Method Summary

Qualifier and Type

Method Name and Description

StorageReference

child(path: string)

指定路径下文件的StorageReference引用。

Promise<void>

delete()

删除StorageReference引用下的文件。

Promise<string>

getDownloadURL()

获取StorageReference引用的下载地址,不支持目录的下载地址获取。

Promise<FileMetadata>

getFileMetadata()

获取StorageReference引用的文件元数据。

Promise<ListResult>

list(options?: ListOptions)

分页获取StorageReference引用下的文件和目录列表信息。

Promise<ListResult>

listAll()

获取StorageReference引用下的所有文件和目录列表信息。

UploadTask

put(data: File | Uint8Array | ArrayBuffer, attribute ?: UploadMetadata)

实例化一个上传任务。该接口仅支持浏览器端。

UploadTask

putString(data: string, format ?: StringFormat, attribute ?: UploadMetadata)

实例化一个上传任务。

Promise<FileMetadata>

put4QuickApp(uri String, attribute ?: UploadMetadata)

实例化一个上传任务。该接口仅支持快应用端。

string

toString()

StorageReference引用的文件的地址信息。

Promise<FileMetadata>

updateFileMetadata(attribute: SetFileMetadata)

更新StorageReference引用下的文件元数据信息,不支持更新目录元数据。

Methods

[h2]child

Method

child(path: string): StorageReference

指定路径下文件的StorageReference引用。

Parameters

Name

Description

path

指定的路径。

Return

Type

Description

StorageReference

返回StorageReference实例。

[h2]delete

Method

delete(): Promise<void>

删除StorageReference引用下的文件。

Return

Type

Description

Promise<void>

删除的异步操作结果信息。

[h2]getDownloadURL

Method

getDownloadURL(): Promise<string>

获取StorageReference引用的下载地址,不支持目录的下载地址获取。

Return

Type

Description

Promise<string>

下载地址的异步操作结果信息。

[h2]getFileMetadata

Method

getFileMetadata(): Promise<FileMetadata>

获取StorageReference引用的文件元数据。

Return

Type

Description

Promise<FileMetadata>

文件元数据的异步操作结果信息。

[h2]list

Method

list(options?: ListOptions): Promise<ListResult>

分页获取StorageReference引用下的文件和目录列表信息。

Parameters

Name

Description

options

分页参数信息。

Return

Type

Description

Promise<ListResult>

文件和目录的列表集合的异步操作结果信息。

[h2]listAll

Method

listAll(): Promise<ListResult>

获取StorageReference引用下的所有文件和目录列表信息。

Return

Type

Description

Promise<ListResult>

文件和目录的列表集合的异步操作结果信息。

[h2]put

Method

put(data: File | Uint8Array | ArrayBuffer, attribute ?: UploadMetadata): UploadTask

实例化一个上传任务。该接口仅支持浏览器端。

Parameters

Name

Description

data

待上传的文件数据。

attribute

上传文件的元数据。

Return

Type

Description

UploadTask

上传文件任务。

[h2]putString

Method

putString(data: string, format ?: StringFormat, attribute ?: UploadMetadata): UploadTask

实例化一个上传任务。

Parameters

Name

Description

data

待上传的文件数据。

format

待上传的文件数据的格式。支持“raw”,“base64”,“base64url”,“data_url”。

attribute

上传文件的元数据。

Return

Type

Description

UploadTask

上传文件任务。

[h2]put4QuickApp

Method

put4QuickApp(uri : String, attribute ?: UploadMetadata): UploadTask

实例化一个上传任务。该接口仅支持快应用端。

Parameters

Name

Description

uri

待上传的文件的本地资源uri标识。

attribute

上传文件的元数据。

Return

Type

Description

Promise<FileMetadata>

上传文件元数据的异步操作结果信息。

[h2]toString

Method

toString(): string

StorageReference引用的文件的地址信息。

Return

Type

Description

string

文件的地址信息。

[h2]updateFileMetadata

Method

updateFileMetadata(attribute: SetFileMetadata): Promise<FileMetadata>

更新StorageReference引用下的文件元数据信息,不支持更新目录元数据。

Parameters

Name

Description

attribute

上传文件的元数据。

Return

Type

Description

Promise<FileMetadata>

元数据更新的异步操作结果信息。