lzma-0.0.0.3: LZMA/XZ compression and decompression

Copyright© 2015 Herbert Valerio Riedel
LicenseBSD3
Maintainerhvr@gnu.org
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

Codec.Compression.Lzma

Contents

Description

Compression and decompression of data streams in the lzma/xz format

See also the XZ Utils home page: http://tukaani.org/xz/

Synopsis

Simple (de)compression

compress :: ByteString -> ByteString Source #

Compress lazy ByteString into .xz format using defaultCompressParams.

decompress :: ByteString -> ByteString Source #

Decompress lazy ByteString from the .xz format

Extended API with control over parameters

compressWith :: CompressParams -> ByteString -> ByteString Source #

Like compress but with the ability to specify various compression parameters. Typical usage:

compressWith defaultCompressParams { compress... = ... }

decompressWith :: DecompressParams -> ByteString -> ByteString Source #

Like decompress but with the ability to specify various decompression parameters. Typical usage:

decompressWith defaultDecompressParams { decompress... = ... }

Monadic incremental (de)compression API

See zlib's incremental API documentation for more information.

Compression

data CompressStream m Source #

Constructors

CompressInputRequired (m (CompressStream m)) (ByteString -> m (CompressStream m))

Compression process requires input to proceed. You can either flush the stream (first field), supply an input chunk (second field), or signal the end of input (via empty chunk).

CompressOutputAvailable !ByteString (m (CompressStream m))

Output chunk available.

CompressStreamEnd 

compressIO :: CompressParams -> IO (CompressStream IO) Source #

Incremental compression in the IO monad.

compressST :: CompressParams -> ST s (CompressStream (ST s)) Source #

Incremental compression in the lazy ST monad.

Decompression

data DecompressStream m Source #

Constructors

DecompressInputRequired (ByteString -> m (DecompressStream m))

Decoding process requires input to proceed. An empty ByteString chunk signals end of input.

DecompressOutputAvailable !ByteString (m (DecompressStream m))

Decompressed output chunk available.

DecompressStreamEnd ByteString

Decoded stream is finished. Any unconsumed leftovers from the input stream are returned via the ByteString field

DecompressStreamError !LzmaRet 

decompressIO :: DecompressParams -> IO (DecompressStream IO) Source #

Incremental decompression in the IO monad.

decompressST :: DecompressParams -> ST s (DecompressStream (ST s)) Source #

Incremental decompression in the lazy ST monad.

Parameters

Compression parameters

defaultCompressParams :: CompressParams Source #

The default set of parameters for compression. This is typically used with the compressWith function with specific parameters overridden.

compressIntegrityCheck :: CompressParams -> IntegrityCheck Source #

CompressParams field: Specify type of integrity check

compressLevelExtreme :: CompressParams -> Bool Source #

CompressParams field: Enable slower variant of the lzmaCompLevel preset, see xz(1) man-page for details.

data CompressionLevel Source #

Compression level presets that define the tradeoff between computational complexity and compression ratio

CompressionLevel0 has the lowest compression ratio as well as the lowest memory requirements, whereas CompressionLevel9 has the highest compression ratio and can require over 600MiB during compression (and over 60MiB during decompression). The man-page for xz(1) contains more detailed information with tables describing the properties of all compression level presets.

CompressionLevel6 is the default setting in defaultCompressParams as it provides a good trade-off and matches the default of the xz(1) tool.

Decompression parameters

defaultDecompressParams :: DecompressParams Source #

The default set of parameters for decompression. This is typically used with the decompressWith function with specific parameters overridden.

decompressTellNoCheck :: DecompressParams -> Bool Source #

DecompressParams field: If set, abort if decoded stream has no integrity check.

decompressTellUnsupportedCheck :: DecompressParams -> Bool Source #

DecompressParams field: If set, abort (via LzmaRetGetCheck) if decoded stream integrity check is unsupported.

decompressTellAnyCheck :: DecompressParams -> Bool Source #

DecompressParams field: If set, abort (via LzmaRetGetCheck) as soon as the type of the integrity check has been detected.

decompressConcatenated :: DecompressParams -> Bool Source #

DecompressParams field: If set, concatenated files as decoded seamless.

decompressAutoDecoder :: DecompressParams -> Bool Source #

DecompressParams field: If set, legacy .lzma-encoded streams are allowed too.

decompressMemLimit :: DecompressParams -> Word64 Source #

DecompressParams field: decompressor memory limit. Set to maxBound to disable memory limit.