* 读取文件内容 * @param type 输出格式:"string" 为文本,"blob" 为二进制(默认) * @returns 文件内容 * @throws {S3Error} 文件不存在或读取失败
(type: "string" | "blob" = "blob")
| 25 | * @throws {S3Error} 文件不存在或读取失败 |
| 26 | */ |
| 27 | async read(type: "string" | "blob" = "blob"): Promise<string | Blob> { |
| 28 | const response = await this.client.request("GET", this.bucket, this.key); |
| 29 | if (type === "string") { |
| 30 | return response.text(); |
| 31 | } |
| 32 | return response.blob(); |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | /** |