ChemPal Documentation - v1.6.0
    Preparing search index...
    • Triggers a browser download of a Blob under the given filename using a transient object URL + anchor click (no downloads permission required). Works in the extension's document context.

      Parameters

      • blob: Blob

        The file contents to download.

      • filename: string

        The suggested filename (e.g. chempal-export.xlsx).

      Returns void

      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);
      }