Files
Jerel 07c479fdab feat: add open-mcp-client showcase example
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 07:15:17 -07:00

16 lines
485 B
TypeScript

/**
* Save a Blob as a file using the browser download path (no pop-up).
* Works after async fetch when the response is same-origin (e.g. /api/workspace/download?stream).
*/
export function triggerBlobDownload(blob: Blob, filename: string): void {
const url = URL.createObjectURL(blob);
const a = document.createElement("a");
a.href = url;
a.download = filename;
a.rel = "noopener";
document.body.appendChild(a);
a.click();
a.remove();
URL.revokeObjectURL(url);
}