conduit-extra-1.1.6.2: Batteries included conduit: adapters for common libraries.

Safe HaskellNone
LanguageHaskell98

Data.Conduit.Zlib

Contents

Description

Streaming compression and decompression using conduits.

Parts of this code were taken from zlib-enum and adapted for conduits.

Synopsis

Conduits

compress Source

Arguments

:: (MonadBase base m, PrimMonad base, MonadThrow m) 
=> Int

Compression level

-> WindowBits

Zlib parameter (see the zlib-bindings package as well as the zlib C library)

-> Conduit ByteString m ByteString 

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

decompress Source

Arguments

:: (MonadBase base m, PrimMonad base, MonadThrow m) 
=> WindowBits

Zlib parameter (see the zlib-bindings package as well as the zlib C library)

-> Conduit ByteString m ByteString 

Decompress (inflate) a stream of ByteStrings. For example:

   sourceFile "test.z" $= decompress defaultWindowBits $$ sinkFile "test"

gzip :: (MonadThrow m, MonadBase base m, PrimMonad base) => Conduit ByteString m ByteString Source

Gzip compression with default parameters.

ungzip :: (MonadBase base m, PrimMonad base, MonadThrow m) => Conduit ByteString m ByteString Source

Gzip decompression with default parameters.

Flushing

compressFlush Source

Arguments

:: (MonadBase base m, PrimMonad base, MonadThrow m) 
=> Int

Compression level

-> WindowBits

Zlib parameter (see the zlib-bindings package as well as the zlib C library)

-> Conduit (Flush ByteString) m (Flush ByteString) 

Same as compress, but allows you to explicitly flush the stream.

decompressFlush Source

Arguments

:: (MonadBase base m, PrimMonad base, MonadThrow m) 
=> WindowBits

Zlib parameter (see the zlib-bindings package as well as the zlib C library)

-> Conduit (Flush ByteString) m (Flush ByteString) 

Same as decompress, but allows you to explicitly flush the stream.

Re-exported from zlib-bindings

data WindowBits :: *

Constructors

WindowBits Int