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 :: MonadIO m => ConduitM ByteString ByteString m ()
- decompress :: (MonadThrow m, MonadIO m) => ConduitM ByteString ByteString m ()
- compressWith :: MonadIO m => CompressParams -> ConduitM ByteString ByteString m ()
- 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 :: (MonadThrow m, MonadIO m) => DecompressParams -> ConduitM ByteString ByteString m ()
- defaultDecompressParams :: DecompressParams
- data DecompressParams
- decompressDisableRingBufferReallocation :: DecompressParams -> Bool
Simple interface
compress :: MonadIO m => ConduitM ByteString ByteString m () Source #
Compress a ByteString
into a Brotli container stream.
decompress :: (MonadThrow m, MonadIO m) => ConduitM ByteString ByteString m () Source #
Decompress a ByteString
from a compressed Brotli stream.
Extended interface
Compression
compressWith :: MonadIO m => CompressParams -> ConduitM ByteString ByteString m () Source #
Like compress
but with the ability to specify various compression
parameters. Typical usage:
compressWith defaultCompressParams { compress... = ... }
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 :: (MonadThrow m, MonadIO m) => DecompressParams -> ConduitM ByteString ByteString m () Source #
Like decompress
but with the ability to specify various decompression
parameters. Typical usage:
decompressWith defaultDecompressParams { decompress... = ... }
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
)