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

Function fetchSplatUrlFile

src/hooks/urlLoaderSplatSource.ts:44–68  ·  view source on GitHub ↗
(
  url: string,
  fetchImpl: FetchUrl = fetchWithTimeout
)

Source from the content-addressed store, hash-verified

42}
43
44export async function fetchSplatUrlFile(
45 url: string,
46 fetchImpl: FetchUrl = fetchWithTimeout
47): Promise<File> {
48 try {
49 const response = await fetchImpl(url);
50 if (!response.ok) {
51 const error: UrlLoadError = {
52 type: response.status === 404 ? 'not_found' : 'network',
53 message: `Failed to fetch splat (${response.status})`,
54 details: response.statusText,
55 failedFile: url,
56 };
57 throw error;
58 }
59
60 const blob = await response.blob();
61 return blobToFile(blob, getFilenameFromUrl(url));
62 } catch (error) {
63 if (isUrlLoadError(error)) {
64 throw error;
65 }
66 throw classifyFetchError(error, url);
67 }
68}
69
70export async function loadSplatUrlSource(
71 url: string,

Callers 1

Calls 5

blobToFileFunction · 0.90
getFilenameFromUrlFunction · 0.90
isUrlLoadErrorFunction · 0.90
classifyFetchErrorFunction · 0.90
blobMethod · 0.80

Tested by

no test coverage detected