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

Function getDownloadProgress

src/utils/zipDownload.ts:100–119  ·  view source on GitHub ↗
(loaded: number, total: number)

Source from the content-addressed store, hash-verified

98}
99
100function getDownloadProgress(loaded: number, total: number): ZipProgress {
101 if (total > 0) {
102 const percent = 2 + Math.round((loaded / total) * 38);
103 const loadedMB = (loaded / (1024 * 1024)).toFixed(1);
104 const totalMB = (total / (1024 * 1024)).toFixed(1);
105 return {
106 percent,
107 message: `Downloading archive (${loadedMB} / ${totalMB} MB)...`,
108 bytesLoaded: loaded,
109 bytesTotal: total,
110 };
111 }
112
113 const loadedMB = (loaded / (1024 * 1024)).toFixed(1);
114 return {
115 percent: 20,
116 message: `Downloading archive (${loadedMB} MB)...`,
117 bytesLoaded: loaded,
118 };
119}

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected