Skip to main content

Compression module · API reference

Use XZ and LZMA where the format requires it.

The XZ codec is loaded on demand through compress-utils, keeping the default bundle small while retaining the shared asynchronous and batched compression interface.

Runtime behavior

Keep the optional codec at the edge of the bundle.

Install the optional compress-utils dependency when an application needs XZ. The encoder and decoder load only when the corresponding operation runs.

Codec

XZ container with LZMA compression

Loading

Direction-specific dynamic backend

Interface

Async and incremental batch methods

Dependency

Optional compress-utils peer package

Detailed guide

XZ implementation details

The reference below documents imports, backend subpaths, installation, batch behavior, and benchmark guidance.

XZ Compressor and Decompressor

From v5.0

XZCompressor and XZDecompressor provide asynchronous XZ/LZMA support through direction-specific compress-utils imports. The encoder or decoder is loaded only when that operation runs.

import {XZCompressor, XZDecompressor} from '@loaders.gl/compression/xz';

Both implement the shared Compressor and Decompressor APIs, including incremental batch methods. Install the optional compress-utils peer dependency.

Backend choice​

The currently supported backend is compress-utils, available directly as xz-compressor-compress-utils and xz-decompressor-compress-utils. Most applications should use the library-neutral defaults.

See the live benchmarks for measured size and throughput.