MCPcopy Index your code
hub / github.com/scriptscat/scriptcat / read

Method read

packages/filesystem/s3/rw.ts:27–33  ·  view source on GitHub ↗

* 读取文件内容 * @param type 输出格式:"string" 为文本,"blob" 为二进制(默认) * @returns 文件内容 * @throws {S3Error} 文件不存在或读取失败

(type: "string" | "blob" = "blob")

Source from the content-addressed store, hash-verified

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/**

Callers

nothing calls this directly

Calls 3

requestMethod · 0.45
textMethod · 0.45
blobMethod · 0.45

Tested by

no test coverage detected