MCPcopy Create free account
hub / github.com/PIKACHUIM/CFWorkerACME / downloadAsFile

Function downloadAsFile

frontend/src/utils/format.ts:77–85  ·  view source on GitHub ↗
(content: string, filename: string)

Source from the content-addressed store, hash-verified

75 * 触发浏览器下载文件
76 */
77export function downloadAsFile(content: string, filename: string): void {
78 const a = document.createElement('a');
79 a.href = URL.createObjectURL(new Blob([content], { type: 'text/plain' }));
80 a.download = filename;
81 document.body.appendChild(a);
82 a.click();
83 document.body.removeChild(a);
84 URL.revokeObjectURL(a.href);
85}
86
87/**
88 * 安全 JSON 解析

Callers 2

runFunction · 0.90
handleDownloadFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected