aboutsummaryrefslogtreecommitdiffstats
path: root/app/src/lib/ts
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/lib/ts')
-rw-r--r--app/src/lib/ts/download.ts5
1 files changed, 4 insertions, 1 deletions
diff --git a/app/src/lib/ts/download.ts b/app/src/lib/ts/download.ts
index 16712fb..c3e98b0 100644
--- a/app/src/lib/ts/download.ts
+++ b/app/src/lib/ts/download.ts
@@ -19,10 +19,11 @@ export default async function saveFile(blob: ArrayBuffer, suggestedName: string
const writable = await handle.createWritable();
await writable.write(blob);
await writable.close();
+ return;
} catch (err: unknown) {
// TypeScript
if ((err as Error)?.name !== 'AbortError') {
- console.error(err);
+ return Promise.reject(err);
}
}
} else {
@@ -30,5 +31,7 @@ export default async function saveFile(blob: ArrayBuffer, suggestedName: string
anchor.download = suggestedName ?? 'truncated';
anchor.href = URL.createObjectURL(new Blob([blob]));
anchor.click();
+ URL.revokeObjectURL(anchor.href);
+ document.body.removeChild(anchor);
}
}