summaryrefslogtreecommitdiff
path: root/apps/web/src/utils/browser.ts
diff options
context:
space:
mode:
authorMaze Winther <mazewinther@gmail.com>2026-02-23 06:44:27 +0100
committerMaze Winther <mazewinther@gmail.com>2026-02-23 06:44:27 +0100
commit5616d4e9f35e20775791ada8d0a271620fc74925 (patch)
tree95f4f393ba5c694d361f998a01af9ffd745eb592 /apps/web/src/utils/browser.ts
parent71970d5f5f5a2d439581785b1e3644ac2e55c1f5 (diff)
downloadopencut-5616d4e9f35e20775791ada8d0a271620fc74925.tar.gz
feat: save frame as image
Diffstat (limited to 'apps/web/src/utils/browser.ts')
-rw-r--r--apps/web/src/utils/browser.ts17
1 files changed, 17 insertions, 0 deletions
diff --git a/apps/web/src/utils/browser.ts b/apps/web/src/utils/browser.ts
index 2b9aa297..cfd3b31b 100644
--- a/apps/web/src/utils/browser.ts
+++ b/apps/web/src/utils/browser.ts
@@ -1,3 +1,20 @@
+export function downloadBlob({
+ blob,
+ filename,
+}: {
+ blob: Blob;
+ filename: string;
+}): void {
+ const url = URL.createObjectURL(blob);
+ const anchor = document.createElement("a");
+ anchor.href = url;
+ anchor.download = filename;
+ document.body.appendChild(anchor);
+ anchor.click();
+ document.body.removeChild(anchor);
+ URL.revokeObjectURL(url);
+}
+
export function isTypableDOMElement({
element,
}: {