| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Lz4.Frame
Contents
Description
Compress a contiguous sequence of bytes into an LZ4 frame containing a single block.
Synopsis
- compressHighlyU :: Int -> Bytes -> ByteArray
- decompressU :: Int -> Bytes -> Maybe ByteArray
Compression
Use HC compression to produce a frame with a single block. All optional fields (checksums, content sizes, and dictionary IDs) are omitted.
Note: Currently, this produces incorrect output when the size of the input to be compressed is greater than 4MiB. The only way to correct this function is to make it not compress large input. This can be done by setting the high bit of the size. This needs to be tested though since it is an uncommon code path.
Decompression
Decompress an LZ4 frame. The caller must know the exact size of the decompressed byte array.
Note: This currently fails if any of the optional headers are used. It is difficult to find examples of lz4 frames that actually use any of these. Open a PR with an example of an lz4 frame that fails to decode if you find one.