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

Function downloadFile

src/pages/options/routes/AgentOPFS.tsx:138–152  ·  view source on GitHub ↗
(name: string)

Source from the content-addressed store, hash-verified

136
137 // 下载文件
138 const downloadFile = async (name: string) => {
139 try {
140 const file = await getFileBlob(name);
141 const url = URL.createObjectURL(file);
142 const a = document.createElement("a");
143 a.href = url;
144 a.download = name;
145 document.body.appendChild(a);
146 a.click();
147 document.body.removeChild(a);
148 URL.revokeObjectURL(url);
149 } catch (e) {
150 Message.error(String(e));
151 }
152 };
153
154 // 删除文件或目录
155 const deleteEntry = (name: string, kind: "file" | "directory") => {

Callers 1

AgentOPFSFunction · 0.85

Calls 3

getFileBlobFunction · 0.85
errorMethod · 0.80
clickMethod · 0.65

Tested by

no test coverage detected