Skip to content

HMath.Interchange.Compression

Module index · Numerical conventions

Description

Optional zlib codecs with an explicit hard decompression budget. No shell process, temporary files, or implicit fallback. A disabled build returns Unsupported. gzip decoding accepts one member and rejects trailing bytes.

On this page

API Purpose
Compression Wire wrappers around the same DEFLATE coding.
RawDeflate Declaration and type contract below.
Zlib Declaration and type contract below.
Gzip Declaration and type contract below.
compressionAvailable Probe whether the optional native zlib adapter is available, returning IO Bool.
compress Given limits,RawDeflateZlibGzip wrapper,then bytes, compress within a bounded output allocation.
decompress The output length may be smaller than the budget.

Documentation

compressionAvailable

compressionAvailable :: IO Bool Source #

Probe whether the optional native zlib adapter is available, returning IO Bool. False means compressed operations cannot run; no payload is processed.

compress

compress :: Limits -> Compression -> ByteString -> IO (Either InterchangeError ByteString) Source #

Given limits,RawDeflateZlibGzip wrapper,then bytes, compress within a bounded output allocation. Return InterchangeError for unavailable provider, invalid limits, byte-budget excess or compression failure in IO.

decompress

decompress :: Limits -> Compression -> Int -> ByteString -> IO (Either InterchangeError ByteString) Source #

The output length may be smaller than the budget. Archives additionally compare it to the declared member size before accepting their payload.