I/O service for Node.js.

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 (ArrayBuffer) and JSON (JSONDocument).


const fs = require('fs');
const path = require('path');
const { NodeIO } = require('@gltf-transform/core');

const io = new NodeIO();

// Read.
io.read('model.glb');             // → Document
io.readBinary(ArrayBuffer);       // → Document

// Write.
io.write('model.glb', doc); // → void
io.writeBinary(doc);        // → ArrayBuffer




  • readBinary(glb: ArrayBuffer): Document
  • registerDependencies(dependencies: {}): NodeIO
  • write(uri: string, doc: Document): void
  • writeBinary(doc: Document): ArrayBuffer
  • writeJSON(doc: Document, _options?: Partial<Pick<WriterOptions, "format" | "basename">>): JSONDocument
Function symbol, f(📦) → 📦, where the argument and output are a box labeled 'glTF'.

Made by Don McCurdy TypeDoc documentation Copyright 2021 under MIT license