nanogl-gltf
Version:
80 lines (79 loc) • 3.11 kB
TypeScript
import IOInterface from "./IOInterface";
import GltfIO from ".";
import { AbortSignal } from '@azure/abort-controller';
/**
* Loader implementation for web usage
*/
export declare class WebImpl implements IOInterface {
/**
* Check if a URI starts with 'data:', meaning it's a base-64 encoded data
* @param uri URI to check
*/
isDataURI(uri: string): boolean;
/**
* Decode a data URI and return the decoded data as an ArrayBuffer, will throw if not a data URI
* @param uri URI to decode
*/
decodeDataURI(uri: string): ArrayBuffer;
/**
* Get the base directory and filename of a file path
* @param path File path to resolve
* @returns [baseDir, filename]
*/
resolveBaseDir(path: string): string[];
/**
* Get the absolute path of a file path relative to a base directory
* @param path File path to resolve
* @param baseurl Base directory to resolve from
*/
resolvePath(path: string, baseurl: string): string;
/**
* Decode an ArrayBuffer encoded as UTF-8
* @param buffer ArrayBuffer to decode
* @param offset Offset in the ArrayBuffer to start decoding from
* @param length Length of the ArrayBuffer to decode
*/
decodeUTF8(buffer: ArrayBuffer, offset?: number, length?: number): string;
/**
* Load a resource and return it as a string
* @param path Path to resource
* @param abortSignal Abort signal if you want to be able to cancel the request at any time
*/
loadResource(path: string, abortSignal?: AbortSignal): Promise<string>;
/**
* Load a resource and return it as an ArrayBuffer
* @param path Path to resource
* @param abortSignal Abort signal if you want to be able to cancel the request at any time
*/
loadBinaryResource(path: string, abortSignal?: AbortSignal): Promise<ArrayBuffer>;
/**
* Load an image from a Uint8Array
* @param arrayView Uint8Array containing the image data
* @param mimetype Image mimetype (image/png, image/webp, ...)
* @param abortSignal Abort signal if you want to be able to cancel the request at any time
*/
loadImageBuffer(arrayView: Uint8Array, mimetype: string, abortSignal?: AbortSignal): Promise<TexImageSource>;
/**
* Load an image from a URI
* @param uri Image URI
* @param abortSignal Abort signal if you want to be able to cancel the request at any time
*/
loadImage(uri: string, abortSignal?: AbortSignal): Promise<TexImageSource>;
/**
* Load a Blob as an image ready to be used as a texture
* @param blob Blob to load
* @param abortSignal Abort signal if you want to be able to cancel the request at any time
*/
loadImageBlob(blob: Blob, abortSignal: AbortSignal): Promise<TexImageSource>;
/**
* @hidden
*/
writeResource(path: string, data: string): Promise<boolean>;
/**
* @hidden
*/
writeBinaryResource(path: string, data: ArrayBuffer): Promise<boolean>;
}
export declare const IO: WebImpl;
declare const _instance: GltfIO;
export default _instance;