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

Method writeJsonFile

src/app/repo/opfs_repo.ts:60–66  ·  view source on GitHub ↗
(filename: string, data: unknown, dir?: FileSystemDirectoryHandle)

Source from the content-addressed store, hash-verified

58
59 // 写入 JSON 文件
60 protected async writeJsonFile(filename: string, data: unknown, dir?: FileSystemDirectoryHandle): Promise<void> {
61 const targetDir = dir || (await this.getDir());
62 const fileHandle = await targetDir.getFileHandle(filename, { create: true });
63 const writable = await fileHandle.createWritable();
64 await writable.write(JSON.stringify(data));
65 await writable.close();
66 }
67
68 // 删除文件,不存在时忽略
69 protected async deleteFile(filename: string, dir?: FileSystemDirectoryHandle): Promise<void> {

Callers 12

saveConversationMethod · 0.80
deleteConversationMethod · 0.80
appendMessageMethod · 0.80
updateMessageMethod · 0.80
saveMessagesMethod · 0.80
saveTasksMethod · 0.80
writeRegistryMethod · 0.80
saveSkillMethod · 0.80
saveConfigValuesMethod · 0.80
appendRunMethod · 0.80
updateRunMethod · 0.80
agent_task.test.tsFile · 0.80

Calls 3

getDirMethod · 0.95
writeMethod · 0.65
closeMethod · 0.65

Tested by

no test coverage detected