mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
After upload: dropzone replaced by image viewer with zoom controls. After processing: review panel shows result preview, file info, download, undo button, and suggested next tools for chaining.
16 lines
417 B
TypeScript
16 lines
417 B
TypeScript
export function triggerDownload(url: string, filename: string) {
|
|
const a = document.createElement("a");
|
|
a.href = url;
|
|
a.download = filename;
|
|
document.body.appendChild(a);
|
|
a.click();
|
|
document.body.removeChild(a);
|
|
}
|
|
|
|
export function formatFileSize(bytes: number): string {
|
|
if (bytes < 1024 * 1024) {
|
|
return `${(bytes / 1024).toFixed(0)} KB`;
|
|
}
|
|
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
}
|