Method
getFileContent
(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> { |
Tested by
no test coverage detected