xpress

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 22, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package xpress also implements the XPRESS (LZ77 + Huffman) compressor, the counterpart to Decompress. Compress emits chunks that Decompress reads back byte-for-byte: a 256-byte codeword-length header followed by the interleaved 16-bit-little-endian bitstream and raw length-overflow bytes, mirroring wimlib's xpress_compress.c output_bitstream exactly.

Package xpress decompresses the XPRESS (LZ77 + Huffman) compression format used by some WIM resources, per [MS-XCA] "LZ77+Huffman". It is a clean-room port of wimlib's xpress_decompress.c.

Each compressed chunk begins with 256 bytes encoding 512 four-bit Huffman codeword lengths (symbols 0-255 are literals; 256-511 are match headers), followed by a 16-bit-little-endian bitstream of Huffman-coded symbols.

Index

Constants

This section is empty.

Variables

View Source
var ErrCorrupt = errors.New("xpress: corrupt data")

ErrCorrupt indicates malformed XPRESS data.

Functions

func Compress added in v0.6.1

func Compress(in []byte) ([]byte, error)

Compress compresses a single XPRESS chunk (len(in) up to 65536; WIM uses 32768). The result, passed to Decompress with len(in) as outSize, reproduces in exactly.

func Decompress

func Decompress(in []byte, outSize int) ([]byte, error)

Decompress decompresses a single XPRESS chunk into exactly outSize bytes.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL