SDK JS
    Preparing search index...

    Interface WasmHostInit

    wasm host initialization for the JPEG XL decoder — where to load/serve the decoder .wasm from, and whether to use the multithreaded build. Used as JxlDecoderOptions.wasmInit.

    The wasm asset precedence (an explicit wasmBytes/wasmUrl here → configure({ wasmBaseUrl }) → the build default) is documented once on core's BitruviusConfig.

    interface WasmHostInit {
        threads?: number | false | "auto";
        wasmBytes?: BufferSource;
        wasmUrl?: string | URL;
    }
    Index

    Properties

    threads?: number | false | "auto"

    Opt into multithreaded decode (wasm-bindgen-rayon over Web Workers + SharedArrayBuffer). Used only on a cross-origin-isolated page (crossOriginIsolated === true); otherwise the single-thread build is used. Ignored when wasmBytes is supplied (the worker pool resolves its worker + wasm by URL, not from raw bytes). Default: single-thread.

    • number — that many worker threads
    • 'auto'navigator.hardwareConcurrency (fallback 4)
    • false — single-thread (default)
    wasmBytes?: BufferSource

    Raw decoder .wasm bytes to instantiate directly (single-thread +simd128 build) — for Node/Bun or any environment without a fetchable URL. Highest precedence; when set the multithread and best-perf builds are skipped and threads is ignored (the worker pool resolves its worker + wasm by URL, not from raw bytes).

    wasmUrl?: string | URL

    Explicit URL to fetch the decoder .wasm from (single-thread +simd128 build). Overrides configure({ wasmBaseUrl }). Works in the browser and Node/Bun.