Overview
The @loaders.gl/compression
module provides a selection of lossless,
compression/decompression "transforms" with a unified interface that work both in browsers and in Node.js
API
Compression Class | Format | Characteristics | Library Size | Notes |
---|---|---|---|---|
NoCompression | none | - | - | |
GzipCompression | gzip(.gz ) | size | Small | |
DeflateCompression | DEFLATE(PKZIP) | size | Small | |
LZ4Compression | LZ4 | speed ("real-time") | Medium | |
ZstdCompression | Zstandard | speed ("real-time") | Large | |
SnappyCompression | Snappy(Zippy) | speed ("real-time") | Small | |
BrotliCompression | Brotli | Size, fast decompress, slow compress | Large | |
LZOCompression | Lempel-Ziv-Oberheimer | size | Node.js only |
Compression Formats
Gzip
GZIP
uses DEFLATE
compression data, wrapping DEFLATE
compression data with
a header and a checksum. The GZIP
format is the most commonly used HTTP compression
scheme, and it is also produced by gzip
tool.
Deflate
DEFLATE
is a patent-free compression algorithm for lossless data compression.
DEFLATE
is a major HTTP compression scheme, and is also used internally in Zip archives
(.zip
files).
Brotli
Brotli
is a newer HTTP compression scheme that results in better (~20%)
compressed data sizes at the cost of slower compression.
Also used internally in e.g. Apache Parquet files.
Note that in contrast to Gzip and Deflate, brotli
is not
supported by all browsers. Therefore resources are usually served
in both brotli
and gzip
versions by a server that understands
the Accept-Encoding
HTTP header.
LZ4
LZ4
is a real-time compression format focused on speed.
Used in e.g. Apache Arrow .feather
files.
Zstandard
Zstandard
is a real-time compression format focused on speed.
Used in e.g. Apache Arrow .feather
files.
Snappy
Snappy
(Previously known as Zippy
) is a real-time compression format that
targets very high compression (GB/s) speed at the cost of compressed size.
Used in e.g. Apache Parquet files.
LZO (Lempel-Ziv-Oberheimer)
Snappy
(Previously known as Zippy
) is a real-time compression format that
targets very high compression (GB/s) speed at the cost of compressed size.
Used in e.g. Apache Parquet files.
Attributions
MIT licensed. This module does not fork any code. however it includes npm dependencies as follows:
| --- | --- | pako | MIT | | lz4 | | | lz4 | | | snappy | | | brotli | Arrow Feather | Optimized for speed (real-time compression) | |