Luxar Viewer API Documentation - v2026.9.22
    Preparing search index...
    • Wrap a zarr.Array with L0 decompressed chunk caching.

      The returned proxy intercepts getChunk() calls:

      1. Checks L0 cache for the requested chunk
      2. On hit: returns cached decompressed data immediately (~1μs)
      3. On miss: calls original getChunk(), caches result, returns data

      All other zarr.Array properties and methods pass through unchanged.

      Type Parameters

      • D extends DataType

      Parameters

      • array: Array<D, Readable>

        Original zarr.Array to wrap

      • cache: DecompressedChunkCache

        L0 decompressed chunk cache instance

      • arrayPath: string

        Full path to the array (used for cache key generation)

      • OptionalgetProbe: () => ResidencyProbe | null

        Optional accessor for the currently-active residency probe. Called on every getChunk to report hit/miss. Returning null (the default / when no load is in flight) disables reporting — this is how prefetch traffic is kept from contaminating a demand load's signal.

      • OptionalgetSignal: () => AbortSignal | null

        Optional accessor for the currently-active per-update AbortSignal. Called on every getChunk; if it returns an aborted signal the call throws (AbortError) BEFORE any L0 lookup, cache fetch, or Blosc decode — so a superseded updateView bails on the warm-cache hit path too (zarrita's own throwIfAborted only fires between chunks of a multi-chunk selection). Mirrors the getProbe thunk lifetime: it reads the owning loader's transient per-update field, so it is naturally per-caller and never aborts a coalesced chunk another live caller awaits.

      Returns Array<D, Readable>

      Proxied zarr.Array with L0 caching enabled

      const cache = new DecompressedChunkCache({ maxSize: 200 * 1024 * 1024 });

      // Wrap array after opening
      const rawArray = await zarr.open(location.resolve('positions'), { kind: 'array' });
      const cachedArray = wrapWithCache(rawArray, cache, '/scene/points/positions');

      // Use normally - getChunk() now checks L0 cache
      const chunk = await cachedArray.getChunk([0, 1, 2]);
      // First call: decompresses and caches
      // Subsequent calls: returns from L0 cache instantly