Copyright | (c) Dong Han 2017-2018 |
---|---|
License | BSD |
Maintainer | winterland1989@gmail.com |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
This module provides zlib bindings.
Synopsis
- data CompressConfig = CompressConfig {}
- defaultCompressConfig :: CompressConfig
- compress :: HasCallStack => CompressConfig -> Bytes -> Bytes
- compressSink :: HasCallStack => CompressConfig -> Sink Bytes -> IO (Sink Bytes)
- type WindowBits = CInt
- defaultWindowBits :: WindowBits
- type MemLevel = CInt
- defaultMemLevel :: MemLevel
- data DecompressConfig = DecompressConfig {}
- defaultDecompressConfig :: DecompressConfig
- decompress :: HasCallStack => DecompressConfig -> Bytes -> Bytes
- decompressSource :: DecompressConfig -> Source Bytes -> IO (Source Bytes)
- type Strategy = CInt
- pattern Z_FILTERED :: Strategy
- pattern Z_HUFFMAN_ONLY :: Strategy
- pattern Z_RLE :: Strategy
- pattern Z_FIXED :: Strategy
- pattern Z_DEFAULT_STRATEGY :: Strategy
- type CompressLevel = CInt
- pattern Z_BEST_SPEED :: CompressLevel
- pattern Z_BEST_COMPRESSION :: CompressLevel
- pattern Z_DEFAULT_COMPRESSION :: CompressLevel
Compression
data CompressConfig Source #
Instances
compress :: HasCallStack => CompressConfig -> Bytes -> Bytes Source #
Compress some bytes.
compressSink :: HasCallStack => CompressConfig -> Sink Bytes -> IO (Sink Bytes) Source #
Compress all the data written to a output.
type WindowBits = CInt Source #
The WindowBits
is the base two logarithm of the maximum window size (the size of the history buffer).
It should be in the range 8..15 for this version of the library. The defaultWindowBits
value is 15. Decompressing windowBits must be greater than or equal to the compressing windowBits. If a compressed stream with a larger window size is given as input, decompress will throw ZDataError
windowBits can also be –8..–15 for raw inflate. In this case, -windowBits determines the window size. inflate() will then process raw deflate data, not looking for a zlib or gzip header, not generating a check value, and not looking for any check values for comparison at the end of the stream.
windowBits can also be greater than 15 for optional gzip decoding. Add 32 to windowBits to enable zlib and gzip decoding with automatic header detection, or add 16 to decode only the gzip format.
The MemLevel
specifies how much memory should be allocated for the internal compression state. 1 uses minimum memory but is slow and reduces compression ratio; 9 uses maximum memory for optimal speed. The default value is 8.
Decompression
data DecompressConfig Source #
Instances
decompress :: HasCallStack => DecompressConfig -> Bytes -> Bytes Source #
Decompress some bytes.
decompressSource :: DecompressConfig -> Source Bytes -> IO (Source Bytes) Source #
Decompress bytes from source.
Constants
Strategy
pattern Z_FILTERED :: Strategy Source #
pattern Z_HUFFMAN_ONLY :: Strategy Source #
pattern Z_DEFAULT_STRATEGY :: Strategy Source #
CompressLevel
type CompressLevel = CInt Source #
pattern Z_BEST_SPEED :: CompressLevel Source #
pattern Z_BEST_COMPRESSION :: CompressLevel Source #
pattern Z_DEFAULT_COMPRESSION :: CompressLevel Source #