MCPcopy Create free account
hub / github.com/Athenodoros/TopHat / createAndDownloadFile

Function createAndDownloadFile

src/shared/data.ts:31–39  ·  view source on GitHub ↗
(name: string, contents: string | Blob)

Source from the content-addressed store, hash-verified

29 return values;
30};
31
32export const zipObject = <K extends string | number, V>(keys: readonly K[], values: readonly V[]) =>
33 zipObjectRaw(keys, values) as Record<K, V>;
34
35export const createAndDownloadFile = (name: string, contents: string | Blob) => {
36 const blob = new Blob([contents], { type: "text/plain" });
37
38 const link = document.createElement("a");
39 link.download = name;
40 link.href = URL.createObjectURL(blob);
41 link.click();
42 URL.revokeObjectURL(link.href);

Callers 3

downloadExampleStatementFunction · 0.90
createJSONDownloadFunction · 0.90
createCSVDownloadFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected