--- title: Snappy compressor and decompressor description: Use Snappy blocks and frames through the shared loaders.gl compression interface. hide_title: true page_style: designed --- import {DocPageHeader} from '@site/src/components/docs/doc-page-header'; import {DocOrientation, ReferenceBoundary} from '@site/src/components/docs/designed-doc'; # Snappy Compressor and Decompressor

From v5.0

`SnappyCompressor` and `SnappyDecompressor` use the `compress-utils` WASM implementation. Snappy is not exposed by the browser stream APIs, so the defaults load the required codec direction dynamically. ```typescript import {SnappyCompressor, SnappyDecompressor} from '@loaders.gl/compression'; ``` Both implement the shared [Compressor and Decompressor](./compressor-decompressor) APIs and support synchronous one-shot operation after preload. ## Backend choices | Backend | Compressor subpath | Decompressor subpath | | --- | --- | --- | | snappyjs | `snappy-compressor-snappyjs` | `snappy-decompressor-snappyjs` | | hysnappy | — | `snappy-decompressor-hysnappy` | | compress-utils | `snappy-compressor-compress-utils` | `snappy-decompressor-compress-utils` | `SnappyHysnappyDecompressor` uses a small embedded WebAssembly decoder. Its asynchronous `preload()` method instantiates one decoder per JavaScript realm, after which `decompressSync()` is available. This can be a better fit for formats such as Parquet that decode many independent blocks and already know each block's uncompressed size. The default is normally the best size/performance balance. See the [live benchmarks](/docs/modules/compression/benchmarks) before pinning another backend. For sync methods, preload first; root callers should use `{useNative: false}` when selecting a WASM implementation for synchronous work.