Skip to content

Constants ​

The following constants are exposed by snappy for format introspection, chunk identification, and buffer sizing.

Stream & Chunk Identifiers ​

ConstantValueDescription
snappy.STREAM_IDENTIFIER"sNaPpY"Magic string contained in the initial stream identifier chunk.
snappy.CHUNK_STREAM_IDENTIFIER0xffChunk type for stream identifier.
snappy.CHUNK_COMPRESSED_DATA0x00Chunk type for compressed block payload with 4-byte masked CRC-32C.
snappy.CHUNK_UNCOMPRESSED_DATA0x01Chunk type for uncompressed payload with 4-byte masked CRC-32C.
snappy.CHUNK_PADDING0xfeChunk type for padding data, safely skipped by decoders.

Block Element Tags ​

ConstantValueDescription
snappy.TAG_LITERAL0x00Lower 2 bits = 0: uncompressed literal bytes.
snappy.TAG_COPY_10x01Lower 2 bits = 1: copy match with 1-byte offset (len: 4..11).
snappy.TAG_COPY_20x02Lower 2 bits = 2: copy match with 2-byte little-endian offset (len: 1..64).
snappy.TAG_COPY_40x03Lower 2 bits = 3: copy match with 4-byte little-endian offset (len: 1..64).

Size & Format Limits ​

ConstantValueDescription
snappy.BLOCK_LOG16Bit width of block size exponent ($2^{16} = 65,536$).
snappy.MAX_BLOCK_SIZE65536Maximum uncompressed payload per block/chunk.
snappy.MAX_VARINT_BYTES5Maximum bytes in a 32-bit little-endian varint.
snappy.version_string"0.0.1"Library version string.

Released under the MIT License.