The file contents to download.
The suggested filename (e.g. chempal-export.xlsx).
downloadBlob(await buildResultsWorkbook(ctx), "chempal-export.xlsx");
export function downloadBlob(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);
}
Triggers a browser download of a Blob under the given filename using a transient object URL + anchor click (no
downloadspermission required). Works in the extension's document context.