SDK JS
    Preparing search index...

    Function createBvcDecoder

    • Detect the runtime, pick the best supported BVC backend (worker pool when available, else in-process), and return a ready Decoder.

      Parameters

      Returns Promise<Decoder>

      A promise resolving to a BvcWorkerDecoder when workers are available (and not forced off), otherwise a BvcDecoder.

      Rejects when the runtime lacks WASM SIMD (the BVC wasm is built with +simd128), or when requested names a backend the runtime cannot support.

      import { createBvcDecoder } from '@bitruvius/bvc';

      const decoder = await createBvcDecoder(); // auto-selects the backend
      const model = await decoder.open(bytes);
      for await (const tile of decoder.decodeTiles(model, bytes)) {
      // upload tile to GPU
      }

      Cross-origin (CDN) use — force in-process and supply wasm bytes so no same-origin worker or asset fetch is required:

      const decoder = await createBvcDecoder({
      requested: 'cpu-wasm', // skip the worker pool
      wasmInit: { wasmBytes }, // bytes you already fetched
      });