Skip to main content

Overview

From-v3.0

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 ClassFormatCharacteristicsLibrary SizeNotes
NoCompressionnone--
GzipCompressiongzip(.gz)sizeSmall
DeflateCompressionDEFLATE(PKZIP)sizeSmall
LZ4CompressionLZ4speed ("real-time")Medium
ZstdCompressionZstandardspeed ("real-time")Large
SnappyCompressionSnappy(Zippy)speed ("real-time")Small
BrotliCompressionBrotliSize, fast decompress, slow compressLarge
LZOCompressionLempel-Ziv-OberheimersizeNode.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) | |