Copyright | © 2016 Herbert Valerio Riedel |
---|---|
License | BSD3 |
Maintainer | hvr@gnu.org |
Safe Haskell | Trustworthy |
Language | Haskell2010 |
Simple IO-Streams interface for Brotli compression (RFC7932).
Synopsis
- compress :: OutputStream ByteString -> IO (OutputStream ByteString)
- decompress :: InputStream ByteString -> IO (InputStream ByteString)
- compressWith :: CompressParams -> OutputStream ByteString -> IO (OutputStream ByteString)
- 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 :: DecompressParams -> InputStream ByteString -> IO (InputStream ByteString)
- defaultDecompressParams :: DecompressParams
- data DecompressParams
- decompressDisableRingBufferReallocation :: DecompressParams -> Bool
Simple interface
compress :: OutputStream ByteString -> IO (OutputStream ByteString) Source #
Convert an OutputStream
that consumes compressed ByteString
s
(in the Brotli format) into an OutputStream
that consumes
uncompressed ByteString
s
decompress :: InputStream ByteString -> IO (InputStream ByteString) Source #
Decompress a Brotli-compressed InputStream
of strict ByteString
s
Extended interface
Compression
compressWith :: CompressParams -> OutputStream ByteString -> IO (OutputStream ByteString) 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 :: DecompressParams -> InputStream ByteString -> IO (InputStream ByteString) 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
)