SDK JS
    Preparing search index...

    Decoder for RIPT (Raster Image Predictive Tiling) raster tiles — a scientific raster codec (an Esri-LERC competitor; lossless + lossy, 14 data types) for elevation, satellite, SAR, and medical imagery.

    The RIPT header is self-describing, so decode returns the pixels in their native typed array(s) together with the RiptInfo metadata — no dimensions or data type to pass in. Decode runs on the calling thread over the pure-Rust wasm; the wasm is initialized lazily on the first call and shared (singleton) across instances. All three RIPT entropy variants decode — uncompressed, LZ4, and Zstd — and produce identical values for the same tile (asserted in ript-conformance.test.ts).

    import { RiptDecoder } from '@bitruvius/ript';

    const decoder = new RiptDecoder();
    const raster = await decoder.decode(bytes); // bytes: Uint8Array of one .ript tile
    if (raster.dtype === 'Float32') {
    const dem = raster.values as Float32Array; // width * height elevation samples
    }
    // Node/Bun (no sibling-.wasm fetch): supply the wasm bytes explicitly.
    import { readFile } from 'node:fs/promises';
    const wasmBytes = await readFile('ript_wasm_bg.wasm');
    const decoder = new RiptDecoder({ wasmInit: { wasmBytes } });
    const raster = await decoder.decode(bytes);
    Index

    Constructors

    Methods

    Constructors

    Methods

    • Decode a RIPT tile to its native typed array(s) plus header metadata.

      Parameters

      • bytes: Uint8Array

        The raw RIPT tile (a complete .ript byte stream).

      Returns Promise<RiptRaster>

      A RiptRaster: the RiptInfo fields plus values — a single typed array for single-band tiles, or one typed array per band for multiband tiles (each width * height elements, row-major).

      If the wasm fails to initialize (see RiptDecoderOptions.wasmInit), if bytes is malformed (bad magic, or a header naming a compression id the format no longer defines), or if the pixel payload fails to decode. The three defined entropy stages — none, LZ4, Zstd — all decode.

      const raster = await new RiptDecoder().decode(bytes);
      // { width, height, dtype: 'Float32', bands: 1, lossy: false, values: Float32Array }
    • Parse the RIPT header without decoding pixels.

      Parameters

      • bytes: Uint8Array

        The raw RIPT tile (a complete .ript byte stream).

      Returns Promise<RiptInfo>

      The self-describing header RiptInfo (width/height in pixels, dtype, band count, lossy flag).

      If the wasm fails to initialize (see RiptDecoderOptions.wasmInit), or if bytes is not a valid RIPT header (bad magic / unsupported header).