Skip to content

frontend / shared/lib/download / downloadBlob

Function: downloadBlob() ​

downloadBlob(blob, filename): void

Defined in: shared/lib/download.ts:14

Persuades the browser to download the given Blob under the specified filename.

Creates temp object URL, attaches it to a hidden anchor element, clicks it, and cleans up both the anchor and the URL after a short delay. Safe to call multiple times in a row — each call uses its own URL.

Parameters ​

blob ​

Blob

Content to download. The MIME type is preserved inside blob-object and passed to the browser as the file's content type.

filename ​

string

Name of the file to save, including extension. The browser may append a numeric suffix if a file with the same name already exists in the download folder.

Returns ​

void