// loaders.gl // SPDX-License-Identifier: MIT // Copyright vis.gl contributors import { DataViewFile } from '@loaders.gl/loader-utils'; import { parse3DTilesArchive as parse3DTilesArchiveFromProvider } from "./3d-tiles-archive/3d-tiles-archive-parser.js"; // __VERSION__ is injected by babel-plugin-version-inline // @ts-ignore TS2304: Cannot find name '__VERSION__'. const VERSION = typeof "4.3.1" !== 'undefined' ? "4.3.1" : 'latest'; /** * Loader for 3tz packages */ export const Tiles3DArchiveFileLoader = { dataType: null, batchType: null, name: '3tz', id: '3tz', module: '3d-tiles', version: VERSION, mimeTypes: ['application/octet-stream', 'application/vnd.maxar.archive.3tz+zip'], parse: parse3DTilesArchive, extensions: ['3tz'], options: {} }; /** * returns a single file from the 3tz archive * @param data 3tz archive data * @param options options * @returns requested file */ async function parse3DTilesArchive(data, options = {}) { const archive = await parse3DTilesArchiveFromProvider(new DataViewFile(new DataView(data))); return archive.getFile(options['3d-tiles-archive']?.path ?? ''); }