decompress package:bzlib

Decompress a stream of data in the bzip2 format. There are a number of errors that can occur. In each case an exception will be thrown. The possible error conditions are:
  • if the stream does not start with a valid gzip header
  • if the compressed stream is corrupted
  • if the compressed stream ends prematurely
Note that the decompression is performed lazily. Errors in the data stream may not be detected until the end of the stream is demanded (since it is only at the end that the final checksum can be checked). If this is important to you, you must make sure to consume the whole decompressed stream before doing any IO action that depends on it.
Like decompress but with the ability to specify various decompression parameters. Typical usage:
decompressWith defaultDecompressParams { ... }
The full set of parameters for decompression. The defaults are defaultDecompressParams. The decompressBufferSize is the size of the first output buffer, containing the uncompressed data. If you know an exact or approximate upper bound on the size of the decompressed data then setting this parameter can save memory. The default decompression output buffer size is 32k. If your estimate is wrong it does not matter too much, the default buffer size will be used for the remaining chunks. One particular use case for setting the decompressBufferSize is if you know the exact size of the decompressed data and want to produce a strict ByteString. The compression and decompression functions use lazy ByteStrings but if you set the decompressBufferSize correctly then you can generate a lazy ByteString with exactly one chunk, which can be converted to a strict ByteString in O(1) time using concat . toChunks.
Includes any trailing unconsumed input data.
An error code
The default set of parameters for decompression. This is typically used with the compressWith function with specific parameters overridden.