WebIO

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).

Usage:

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

Hierarchy

Constructor

  • constructor(fetchConfig?: RequestInit): WebIO

Properties

Methods

  • binaryToJSON(glb: Uint8Array): Promise<JSONDocument>
  • readBinary(glb: Uint8Array): Promise<Document>
  • readAsJSON(uri: string): Promise<JSONDocument>
  • read(uri: string): Promise<Document>
  • registerExtensions(extensions: (typeof Extension)[]): PlatformIO
  • registerDependencies(dependencies: { [key: string]: unknown }): PlatformIO
  • writeJSON(doc: Document, _options?: PublicWriterOptions): Promise<JSONDocument>
  • writeBinary(doc: Document): Promise<Uint8Array>
Function symbol, where the argument and output are a box labeled 'glTF'.

Made by Don McCurdy. Documentation built with greendoc and published under Creative Commons Attribution 3.0.