I/O service for Web.

The most common use of the I/O service is to read/write a Document with a given path. Methods are also available for converting in-memory representations of raw glTF files, both binary (Uint8Array) and JSON (JSONDocument).


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



  • new WebIO(fetchConfig?: RequestInit): WebIO


  • readBinary(glb: Uint8Array): Promise<Document>
  • readURI(uri: string, type: "view"): Promise<Uint8Array>
  • readURI(uri: string, type: "text"): Promise<string>
  • registerDependencies(dependencies: {}): WebIO
  • setLogger(logger: ILogger): WebIO
  • writeBinary(doc: Document): Promise<Uint8Array>
  • writeJSON(doc: Document, _options?: Partial<Pick<WriterOptions, "format" | "basename">>): Promise<JSONDocument>
Function symbol, f(📦) → 📦, where the argument and output are a box labeled 'glTF'.

Made by Don McCurdy TypeDoc documentation Copyright 2023, MIT license