MCPcopy Create free account
hub / github.com/ColmapView/Colmapview.github.io / loadZipFromFile

Function loadZipFromFile

src/utils/zipLoader.ts:248–279  ·  view source on GitHub ↗
(
  zipFile: File,
  onProgress: (progress: ZipProgress) => void
)

Source from the content-addressed store, hash-verified

246 * Extracts COLMAP files immediately and builds an index for lazy image extraction.
247 */
248export async function loadZipFromFile(
249 zipFile: File,
250 onProgress: (progress: ZipProgress) => void
251): Promise<ZipLoadResult> {
252 // Initialize libarchive.js
253 await initializeArchive();
254
255 onProgress({ percent: 0, message: 'Checking archive...' });
256
257 // Validate size
258 const validation = validateZipFile(zipFile);
259 if (!validation.valid) {
260 throw new Error(validation.error ?? 'Invalid archive');
261 }
262
263 onProgress({ percent: 40, message: 'Opening archive...' });
264
265 // Open archive
266 const archive = await Archive.open(zipFile);
267
268 // Process archive
269 const { colmapFiles, imageIndex, imageCount } = await processZipArchive(archive, onProgress);
270
271 // Verify we have required COLMAP files
272 if (!hasRequiredColmapArchiveFiles(colmapFiles.keys())) {
273 throw new Error(
274 'ZIP does not contain valid COLMAP files (cameras.bin, images.bin, points3D.bin)'
275 );
276 }
277
278 return { colmapFiles, imageIndex, archive, fileSize: zipFile.size, imageCount };
279}

Callers

nothing calls this directly

Calls 5

validateZipFileFunction · 0.90
initializeArchiveFunction · 0.85
processZipArchiveFunction · 0.85
openMethod · 0.45

Tested by

no test coverage detected