Files
edr-platform/apps/edr-freight-web/portal/src/utils/download.ts
2026-07-01 06:56:58 +00:00

12 lines
337 B
TypeScript

/** Trigger a browser download of a Blob under `filename`. */
export function saveBlob(blob: Blob, filename: string): void {
const url = URL.createObjectURL(blob);
const a = document.createElement("a");
a.href = url;
a.download = filename;
document.body.appendChild(a);
a.click();
a.remove();
URL.revokeObjectURL(url);
}