aboutsummaryrefslogtreecommitdiffstats
path: root/app/src/lib/ts/download.ts
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--app/src/lib/ts/download.ts32
1 files changed, 16 insertions, 16 deletions
diff --git a/app/src/lib/ts/download.ts b/app/src/lib/ts/download.ts
index c3e98b0..48debec 100644
--- a/app/src/lib/ts/download.ts
+++ b/app/src/lib/ts/download.ts
@@ -5,33 +5,33 @@ export default async function saveFile(blob: ArrayBuffer, suggestedName: string
'showSaveFilePicker' in window &&
(() => {
try {
- return window.self === window.top;
+ return window.self === window.top
} catch {
- return false;
+ return false
}
- })();
+ })()
if (supportsFSAccess) {
try {
const handle = await window.showSaveFilePicker({
- suggestedName: suggestedName
- });
- const writable = await handle.createWritable();
- await writable.write(blob);
- await writable.close();
- return;
+ suggestedName: suggestedName,
+ })
+ const writable = await handle.createWritable()
+ await writable.write(blob)
+ await writable.close()
+ return
} catch (err: unknown) {
// TypeScript
if ((err as Error)?.name !== 'AbortError') {
- return Promise.reject(err);
+ return Promise.reject(err)
}
}
} else {
- const anchor = document.createElement('a');
- anchor.download = suggestedName ?? 'truncated';
- anchor.href = URL.createObjectURL(new Blob([blob]));
- anchor.click();
- URL.revokeObjectURL(anchor.href);
- document.body.removeChild(anchor);
+ const anchor = document.createElement('a')
+ anchor.download = suggestedName ?? 'truncated'
+ anchor.href = URL.createObjectURL(new Blob([blob]))
+ anchor.click()
+ URL.revokeObjectURL(anchor.href)
+ document.body.removeChild(anchor)
}
}