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

Function fetchManifestFile

src/hooks/urlLoaderManifestFetch.ts:626–649  ·  view source on GitHub ↗
(
  baseUrl: string,
  relativePath: string,
  options: FetchManifestFileOptions = {}
)

Source from the content-addressed store, hash-verified

624}
625
626export async function fetchManifestFile(
627 baseUrl: string,
628 relativePath: string,
629 options: FetchManifestFileOptions = {}
630): Promise<File> {
631 const fetchImpl = options.fetchImpl ?? defaultFetchUrl;
632 const fullUrl = joinManifestUrlPath(baseUrl, relativePath);
633 const response = await fetchImpl(fullUrl);
634
635 if (!response.ok) {
636 const errorType: UrlLoadErrorType = response.status === 404 ? 'not_found' : 'network';
637 const error: UrlLoadError = {
638 type: errorType,
639 message: `Failed to fetch file (${response.status})`,
640 details: `${relativePath}: ${response.statusText}`,
641 failedFile: fullUrl,
642 };
643 throw error;
644 }
645
646 const blob = await readResponseToBlob(response, options.onProgress);
647 const filename = getFilenameFromUrl(fullUrl);
648 return blobToFile(blob, filename);
649}
650
651export async function fetchManifestColmapFiles(
652 manifest: ColmapManifest,

Callers 2

fetchManifestColmapFilesFunction · 0.85

Calls 4

joinManifestUrlPathFunction · 0.90
readResponseToBlobFunction · 0.90
getFilenameFromUrlFunction · 0.90
blobToFileFunction · 0.90

Tested by

no test coverage detected