MCPcopy Index your code
hub / github.com/ColmapView/Colmapview.github.io / downloadBlob

Function downloadBlob

src/utils/download.ts:12–30  ·  view source on GitHub ↗
(blob: Blob, filename: string)

Source from the content-addressed store, hash-verified

10}
11
12export function downloadBlob(blob: Blob, filename: string): void {
13 const url = URL.createObjectURL(blob);
14 const now = Date.now();
15 const fireAt = Math.max(now, nextDownloadSlotAt);
16 nextDownloadSlotAt = fireAt + DOWNLOAD_STAGGER_MS;
17
18 const trigger = () => {
19 const a = document.createElement('a');
20 a.href = url;
21 a.download = filename;
22 document.body.appendChild(a);
23 a.click();
24 document.body.removeChild(a);
25 setTimeout(() => URL.revokeObjectURL(url), DOWNLOAD_REVOKE_DELAY_MS);
26 };
27
28 if (fireAt === now) trigger();
29 else setTimeout(trigger, fireAt - now);
30}
31
32export function downloadFile(data: ArrayBuffer | string, filename: string): void {
33 const blob =

Callers 7

SettingsPanelFunction · 0.90
ExportPanel.tsxFile · 0.90
DropZoneFunction · 0.90
downloadImagesZipFunction · 0.90
downloadMasksZipFunction · 0.90
downloadFileFunction · 0.85

Calls 1

triggerFunction · 0.85

Tested by

no test coverage detected