DenoIO

I/O service for Deno.

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

NOTICE: Support for the Deno environment is currently experimental. See glTF-Transform#457.

Usage:

import { DenoIO } from 'https://esm.sh/@gltf-transform/core';
import * as path from 'https://deno.land/std/path/mod.ts';

const io = new DenoIO(path);

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

// Write.
const glb = io.writeBinary(document);  // Document → Uint8Array

Hierarchy

Constructor

  • constructor(path: unknown): DenoIO

Properties

Methods

  • binaryToJSON(glb: Uint8Array): Promise<JSONDocument>
  • read(uri: string): Promise<Document>
  • readAsJSON(uri: string): Promise<JSONDocument>
  • readBinary(glb: Uint8Array): Promise<Document>
  • registerDependencies(dependencies: { [key: string]: unknown }): PlatformIO
  • registerExtensions(extensions: (typeof Extension)[]): PlatformIO
  • Sets whether missing external resources should throw errors (strict mode) or be ignored with warnings. Missing images can be ignored, but missing buffers will currently always result in an error. When strict mode is disabled and missing resources are encountered, the resulting Document will be created in an invalid state. Manual fixes to the Document may be necessary, resolving null images in Textures or removing the affected Textures, before the Document can be written to output or used in transforms.

    Defaults to true (strict mode).

  • writeBinary(doc: Document): Promise<Uint8Array<ArrayBuffer>>
  • writeJSON(doc: Document,_options?: PublicWriterOptions): Promise<JSONDocument>
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.