zlib-enum-0.2.3.1: Enumerator interface for zlib compression

Safe Haskell | None
Language | Haskell98

Codec.Zlib.Enum

Contents

- Enumeratees
- Re-exported from zlib-bindings

Synopsis

- compress :: MonadIO m => Int -> WindowBits -> Enumeratee ByteString ByteString m a
- decompress :: MonadIO m => WindowBits -> Enumeratee ByteString ByteString m a
- gzip :: MonadIO m => Enumeratee ByteString ByteString m a
- ungzip :: MonadIO m => Enumeratee ByteString ByteString m a
- data WindowBits :: * = WindowBits Int
- defaultWindowBits :: WindowBits
- data ZlibException :: *

# Enumeratees

compress Source

Arguments

:: MonadIO m |
=> Int | Compression level
-> WindowBits | Zlib parameter (see the zlib-bindings package as well as the zlib C library)
-> Enumeratee ByteString ByteString m a |

Compress (deflate) a stream of `ByteString`s. The `WindowBits` also control the format (zlib vs. gzip).

decompress Source

Arguments

:: MonadIO m |
=> WindowBits | Zlib parameter (see the zlib-bindings package as well as the zlib C library)
-> Enumeratee ByteString ByteString m a |

Decompress (inflate) a stream of `ByteString`s. For example:

       run $ enumFile "test.z" $$ decompress defaultWindowBits $$ printChunks True

gzip :: MonadIO m => Enumeratee ByteString ByteString m a Source

Gzip compression with default parameters.

ungzip :: MonadIO m => Enumeratee ByteString ByteString m a Source

Gzip decompression with default parameters.

# Re-exported from zlib-bindings

data WindowBits :: *

Constructors

WindowBits Int |

Instances

Eq WindowBits |
Ord WindowBits |
Show WindowBits |
Generic WindowBits |
type Rep WindowBits = D1 D1WindowBits ((:+:) (C1 C1_0WindowBits (S1 NoSelector (Rec0 Int))) (C1 C1_1WindowBits U1)) |

defaultWindowBits :: WindowBits

data ZlibException :: *

Exception that can be thrown from the FFI code. The parameter is the numerical error code from the zlib library. Quoting the zlib.h file directly:

- #define Z_OK 0
- #define Z_STREAM_END 1
- #define Z_NEED_DICT 2
- #define Z_ERRNO (-1)
- #define Z_STREAM_ERROR (-2)
- #define Z_DATA_ERROR (-3)
- #define Z_MEM_ERROR (-4)
- #define Z_BUF_ERROR (-5)
- #define Z_VERSION_ERROR (-6)

Instances

Show ZlibException |
Exception ZlibException |