UNPKG

@gltf-transform/core

Version:

glTF 2.0 SDK for JavaScript and TypeScript, on Web and Node.js.

39 lines (38 loc) 1.26 kB
import { PlatformIO } from './platform-io.js'; /** * *I/O service for Web.* * * The most common use of the I/O service is to read/write a {@link Document} with a given path. * Methods are also available for converting in-memory representations of raw glTF files, both * binary (*Uint8Array*) and JSON ({@link JSONDocument}). * * Usage: * * ```typescript * import { WebIO } from '@gltf-transform/core'; * * const io = new WebIO({credentials: 'include'}); * * // Read. * let document; * document = await io.read('model.glb'); // → Document * document = await io.readBinary(glb); // Uint8Array → Document * * // Write. * const glb = await io.writeBinary(document); // Document → Uint8Array * ``` * * @category I/O */ export declare class WebIO extends PlatformIO { private readonly _fetchConfig; /** * Constructs a new WebIO service. Instances are reusable. * @param fetchConfig Configuration object for Fetch API. */ constructor(fetchConfig?: RequestInit); protected readURI(uri: string, type: 'view'): Promise<Uint8Array>; protected readURI(uri: string, type: 'text'): Promise<string>; protected resolve(base: string, path: string): string; protected dirname(uri: string): string; }