Expand description
Compression utilities for tiles. The format is zstd-only — there is no
gzip path (it was never shipped; zstd beats it on both ratio and browser
decode). Compression::None exists only for already-incompressible blobs.
Constants§
- ZSTD_
LEVEL - Default zstd level. Level 3 is zstd’s documented “fast” sweet spot —
roughly gzip-6 ratio at ~5x the encode speed; higher levels save a few
percent at significant CPU cost.
Default zstd level for the packed format — see the constant doc above.
compress_zstd_with_dictand the writers use this unless an explicit level is threaded through (e.g.stt-build --zstd-level). - ZSTD_
LEVEL_ MAX - Highest level we expose. zstd defines 1..=22; level 19 is the practical ceiling (19 ≈ 22 on STT tiles, measured) but we accept up to 22.
Functions§
- compress
- Compress data using the specified compression method
- compress_
zstd_ with_ dict - Compress a payload with zstd using an optional pre-shared dictionary, at the
default level (
ZSTD_LEVEL). Thin wrapper overcompress_zstd_with_dict_level— kept as the stable call site for the many writers that don’t tune the level. - compress_
zstd_ with_ dict_ level - Compress a payload with zstd at an explicit
level, with an optional pre-shared dictionary. - decompress
- Decompress data using the specified compression method
- decompress_
zstd_ with_ dict - Decompress zstd data, applying a pre-shared dictionary when supplied.
- train_
zstd_ dictionary - Train a zstd dictionary from a sample of payloads.
- train_
zstd_ dictionary_ from_ slices - Train a zstd dictionary from borrowed payload slices (no cloning).