Chevron Down
Table of Contents
Chevron DownAPI Reference

GLBWriter

The GLBWriter is a writer for the GLB binary "envelope".

Note: applications that want to encode GLB-formatted glTF files use the GLTFWriter instead. The GLBWriter is intended to be used to save custom data that combines JSON and binary resources.

LoaderCharacteristic
File Extensions.glb
File TypeBinary
Data FormatSee below
File FormatGLB
Encoder TypeSynchronous
Worker Thread SupportNo
Streaming SupportNo

Usage

import {GLBWriter} from '@loaders.gl/gltf';
import {encodeSync} from '@loaders.gl/core';

const arrayBuffer = encodeSync(gltf, GLBWriter, options);

Options

OptionTypeDefaultDescription
magicNumberglTFThe magic number to be save in the file.

Data Format

See GLBLoader.

FieldTypeDefaultDescription
magicNumberglTFThe first four bytes of the file
versionNumber2The version number
jsonObject{}The JSON chunk
binaryArrayBuffernullThe binary chunk