See CreateBvcDecoderOptions: requested to force a backend,
caps to override detection, poolSize/spawn for the worker backend, wasmInit
for wasm load overrides. All optional.
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:
Detect the runtime, pick the best supported BVC backend (worker pool when available, else in-process), and return a ready
Decoder.