Compress bytes into a raw DEFLATE stream at the given level.
This never fails. It crashes only on a bug in this package.
:= []
Compress bytes into a raw DEFLATE stream at the given level.
This never fails. It crashes only on a bug in this package.
compress_bound : U64 -> U64
The largest a compressed stream can be, matching libdeflate's bound.
The compressor never uses a compressed block where an uncompressed one would be cheaper, so the worst case is all uncompressed blocks: five bytes of header each, over blocks no shorter than the minimum block length.
Decompress a raw DEFLATE stream.
Decompress a raw DEFLATE stream, appending the output to out.
Passing a list with enough spare capacity for the whole result means the decompressor never reallocates mid-stream, and a returned list can be emptied with its capacity kept and passed back in for the next stream.
The stream cannot refer back into the bytes out already holds. A
match that reaches past the start of the stream's own output is
CorruptData, the same as with an empty out.
Deflate.Level :: # (opaque)
A compression level from 0 to 12, with libdeflate's meaning: 0 stores the input without compressing it, 1 is the fastest, 6 the usual default, and 12 searches hardest.
A number literal is a Level wherever one is expected, so
Deflate.compress(bytes, 6) works, and a literal outside 0 to 12 is a
compile-time error. A level only known at runtime, such as one read from
a command-line argument, goes through from_u64.
is_eq : _
to_hash : _
from_numeral : Numeral -> Try(Level, [InvalidNumeral(Str)])
Turn a number literal into a level when the program is compiled, rejecting any literal that is not a whole number from 0 to 12.
The level for a number only known at runtime.
The level's number, from 0 to 12.
Every level, from 0 to 12.