SDK JS
    Preparing search index...

    Decodes a standalone Niantic SPZ file to a flat SpzGaussianCloud.

    Handles every SPZ version — v1, v2, v3, and v4 (legacy gzip-framed v1–v3 are auto-detected by magic). Decode-only; the encoder is not shipped in the wasm. The wasm is a lazily-initialized singleton — the first decode on the page pays the init cost; reuse one instance for many files.

    import { SpzDecoder } from '@bitruvius/turbo-spz';

    const bytes = new Uint8Array(await (await fetch('scene.spz')).arrayBuffer());
    const cloud = await new SpzDecoder().decode(bytes);
    console.log(cloud.numPoints, cloud.shDegree);
    // cloud.positions is a Float32Array of length cloud.numPoints * 3
    Index

    Constructors

    Methods

    Constructors

    Methods

    • Decode one SPZ file to a flat gaussian cloud.

      Parameters

      • bytes: Uint8Array

        The raw .spz file bytes (any SPZ version; gzip framing is handled).

      Returns Promise<SpzGaussianCloud>

      The decoded SpzGaussianCloud (parallel Float32Arrays in the file's local meters).

      If the wasm fails to initialize (see WasmHostInit), or if bytes are not a valid/recognized SPZ stream — the wasm decode rejects.