MCPcopy Create free account
hub / github.com/scriptscat/scriptcat / getFileContent

Method getFileContent

src/pkg/backup/import.ts:43–48  ·  view source on GitHub ↗
(file: FileInfo, toJson: boolean, type?: "string" | "blob")

Source from the content-addressed store, hash-verified

41 }
42
43 async getFileContent(file: FileInfo, toJson: boolean, type?: "string" | "blob"): Promise<string | any> {
44 const fileReader = await this.fs.open(file);
45 const fileContent = await fileReader.read(type);
46 if (toJson) return JSON.parse(fileContent);
47 return fileContent;
48 }
49
50 // 解析出备份数据
51 async parse(): Promise<BackupData> {

Callers 1

parseMethod · 0.95

Calls 3

openMethod · 0.65
readMethod · 0.65
parseMethod · 0.45

Tested by

no test coverage detected