diff --git a/web/src/lib/downloadBlob.ts b/web/src/lib/downloadBlob.ts new file mode 100644 index 0000000..8614abf --- /dev/null +++ b/web/src/lib/downloadBlob.ts @@ -0,0 +1,8 @@ +export function downloadBlob(filename: string, content: string, mimeType = "text/plain") { + const blob = new Blob([content], { type: mimeType }); + const a = document.createElement("a"); + a.href = URL.createObjectURL(blob); + a.download = filename; + a.click(); + URL.revokeObjectURL(a.href); +}