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


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

const io = new NodeIO();

// Read.
let document;
document = await io.read('model.glb'); // → Document
document = await io.readBinary(glb);   // Uint8Array → Document

// Write.
await io.write('model.glb', document);      // → void
const glb = await io.writeBinary(document); // Document → Uint8Array

By default, NodeIO can only read/write paths on disk. To enable HTTP requests, provide a Fetch API implementation (such as node-fetch) and enable {@link setAllowHTTP}. HTTP requests may optionally be configured with RequestInit parameters.

import fetch from 'node-fetch';

const io = new NodeIO(fetch, {headers: {...}}).setAllowHTTP(true);

const document = await io.read('https://example.com/path/to/model.glb');



  • new NodeIO(_fetch?: unknown, _fetchConfig?: RequestInit): NodeIO


  • readBinary(glb: Uint8Array): Promise<Document>
  • readURI(uri: string, type: "view"): Promise<Uint8Array>
  • readURI(uri: string, type: "text"): Promise<string>
  • registerDependencies(dependencies: {}): NodeIO
  • write(uri: string, doc: Document): Promise<void>
  • 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 2021 under MIT license