n3-lib TypeScript API
    Preparing search index...

    n3-lib TypeScript API

    n3-lib for TypeScript

    Renderer-independent N3 asset readers and writers. ESM, Node 24+, modern browsers, strict declarations, and no WASM, native bindings or Rust build.

    import { parseN3Cpart, writeN3Cpart, utf8 } from "n3-lib";

    const document = parseN3Cpart(bytes);
    document.name = utf8("model");
    const output = writeN3Cpart(document);

    Use the parser for the known format, such as parseN3Pmesh(bytes), parseDxt(bytes), parseTbl(bytes) or parseBmp(bytes). The package does not accept filenames or detect formats from extensions; applications own that logic.

    From the repository: npm ci, npm run build:ts, npm run test:ts and npm run check:package. From this directory after workspace installation: npm run build, npm test and npm run typecheck.

    Wire strings retain original hex bytes; f32 fields retain unsigned storage bits. Use text, utf8, floatValue, floatBits, meshGeometry and skinGeometry for deliberate conversions. UTF-8 is not a replacement for EUC-KR when editing legacy non-ASCII strings. Supply bytes in the asset's actual encoding.

    Texture creation and DXT1/3/5 encoding use MIT-licensed pure-JavaScript dxtn. Coverage applies to documented layout profiles, not all historical N3 versions. See https://alicanc.github.io/n3-lib/ for API, field layouts and limitations.