Copyright | © 2016 Herbert Valerio Riedel |
---|---|
Maintainer | hvr@gnu.org |
Safe Haskell | Trustworthy |
Language | Haskell2010 |
Compression and decompression of data streams in the "Brotli" format (RFC7932)
Synopsis
- compress :: forall m r. MonadIO m => Producer ByteString m r -> Producer ByteString m r
- decompress :: forall m r. MonadIO m => Producer ByteString m r -> Producer ByteString m (Producer ByteString m r)
- compressWith :: forall m r. MonadIO m => CompressParams -> Producer ByteString m r -> Producer ByteString m r
- defaultCompressParams :: CompressParams
- data CompressParams
- compressLevel :: CompressParams -> CompressionLevel
- compressWindowSize :: CompressParams -> CompressionWindowSize
- compressMode :: CompressParams -> CompressionMode
- compressSizeHint :: CompressParams -> Word32
- data CompressionLevel
- data CompressionWindowSize
- = CompressionWindowBits10
- | CompressionWindowBits11
- | CompressionWindowBits12
- | CompressionWindowBits13
- | CompressionWindowBits14
- | CompressionWindowBits15
- | CompressionWindowBits16
- | CompressionWindowBits17
- | CompressionWindowBits18
- | CompressionWindowBits19
- | CompressionWindowBits20
- | CompressionWindowBits21
- | CompressionWindowBits22
- | CompressionWindowBits23
- | CompressionWindowBits24
- data CompressionMode
- decompressWith :: forall m r. MonadIO m => DecompressParams -> Producer ByteString m r -> Producer ByteString m (Producer ByteString m r)
- defaultDecompressParams :: DecompressParams
- data DecompressParams
- decompressDisableRingBufferReallocation :: DecompressParams -> Bool
Simple interface
compress :: forall m r. MonadIO m => Producer ByteString m r -> Producer ByteString m r Source #
Compress a ByteString
.
decompress :: forall m r. MonadIO m => Producer ByteString m r -> Producer ByteString m (Producer ByteString m r) Source #
Decompress a ByteString
.
Extended interface
Compression
compressWith :: forall m r. MonadIO m => CompressParams -> Producer ByteString m r -> Producer ByteString m r Source #
Compress a ByteString
with a given set of CompressParams
.
defaultCompressParams :: CompressParams #
The default set of parameters for compression. This is typically
used with the compressWith
function with specific parameters
overridden.
data CompressParams #
Set of parameters for compression. The defaults are defaultCompressParams
.
compressLevel :: CompressParams -> CompressionLevel #
CompressParams
field: See documentation of CompressionLevel
compressWindowSize :: CompressParams -> CompressionWindowSize #
CompressParams
field: See documentation of CompressionWindowSize
compressMode :: CompressParams -> CompressionMode #
CompressParams
field: See documentation of CompressionMode
compressSizeHint :: CompressParams -> Word32 #
CompressParams
field: Estimated total input size. The default value is 0
, which means that the total input size is unknown.
data CompressionLevel #
Compression quality setting
CompressionLevel0 | fastest/lowest compression level |
CompressionLevel1 | |
CompressionLevel2 | |
CompressionLevel3 | |
CompressionLevel4 | |
CompressionLevel5 | |
CompressionLevel6 | |
CompressionLevel7 | |
CompressionLevel8 | |
CompressionLevel9 | |
CompressionLevel10 | |
CompressionLevel11 | slowest/highest compression level (default) |
Instances
data CompressionWindowSize #
Recommended sliding LZ77 window size.
The encoder may reduce this value (if e.g. input is much smaller than window size).
CompressionWindowBits10 | 1008 bytes |
CompressionWindowBits11 | 2032 bytes |
CompressionWindowBits12 | 4080 bytes |
CompressionWindowBits13 | 8176 bytes |
CompressionWindowBits14 | 16368 bytes |
CompressionWindowBits15 | 32752 bytes |
CompressionWindowBits16 | 65520 bytes |
CompressionWindowBits17 | 131056 bytes |
CompressionWindowBits18 | 262128 bytes |
CompressionWindowBits19 | 524272 bytes |
CompressionWindowBits20 | 1048560 bytes |
CompressionWindowBits21 | 2097136 bytes |
CompressionWindowBits22 | 4194288 bytes (default) |
CompressionWindowBits23 | 8388592 bytes |
CompressionWindowBits24 | 16777200 bytes |
Instances
data CompressionMode #
Encoding profile
CompressionModeGeneric | Format-agnostic default mode |
CompressionModeText | UTF-8 formatted text data |
CompressionModeFont | Compression mode used in WOFF 2.0 |
Instances
Eq CompressionMode | |
Defined in LibBrotli (==) :: CompressionMode -> CompressionMode -> Bool # (/=) :: CompressionMode -> CompressionMode -> Bool # | |
Read CompressionMode | |
Defined in LibBrotli | |
Show CompressionMode | |
Defined in LibBrotli showsPrec :: Int -> CompressionMode -> ShowS # show :: CompressionMode -> String # showList :: [CompressionMode] -> ShowS # |
Decompression
decompressWith :: forall m r. MonadIO m => DecompressParams -> Producer ByteString m r -> Producer ByteString m (Producer ByteString m r) Source #
Decompress a ByteString
with a given set of DecompressParams
.
defaultDecompressParams :: DecompressParams #
The default set of parameters for decompression. This is
typically used with the decompressWith
function with specific
parameters overridden.
data DecompressParams #
Set of parameters for decompression. The defaults are
defaultDecompressParams
.
decompressDisableRingBufferReallocation :: DecompressParams -> Bool #
DecompressParams
field: If True
, ring buffer is allocated according to window size, despite the real size of the content. (default: False
)