diff options
Diffstat (limited to 'app/src/lib/ts/download.ts')
-rw-r--r-- | app/src/lib/ts/download.ts | 5 |
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); } } |