streaming-utils-0.1.4.4: Experimental http-client, aeson, attoparsec, zlib and pipes utilities for use with the <http://hackage.haskell.org/package/streaming streaming> and <http://hackage.haskell.org/package/streaming-bytestring streaming bytestring> libraries. They generally closely follow similarly named modules in the pipes \'ecosystem\', using similar function names, where possible. Thus, for example, using the http client module, we might number the lines of a remote document thus: > import Streaming > import Streaming.Prelude (with, each) > import qualified Streaming.Prelude as S > import Data.ByteString.Streaming.HTTP > import qualified Data.ByteString.Streaming.Char8 as Q > > main = runResourceT $ do > let output = numbers <|> Q.lines (simpleHTTP "http://lpaste.net/raw/146542") > Q.putStrLn $ Q.unlines output > > numbers :: Monad m => Stream (Q.ByteString m) m () > numbers = with (each [1..]) $ \n -> Q.pack (each (show n ++ ". ")) > -- ["1. ", "2. " ..] The memory requirements of this @Prelude@-ish program will not be affected by the fact that, say, the third \'line\' is 10 terabytes long. This package of course heaps together a number of dependencies, as it seemed best not to spam hackage with numerous packages. If it seems reasonable to detach some of it, please raise an issue on the github page. Questions about usage can be raised as issues, or addressed to the <https://groups.google.com/forum/#!forum/haskell-pipes pipes list>.

Safe HaskellNone
LanguageHaskell2010

Streaming.Zip

Contents

Description

This module modifies material in Renzo Carbonara's pipes-zlib package.

Synopsis

Streams

decompress Source #

Arguments

:: MonadIO m 
=> WindowBits 
-> ByteString m r

Compressed stream

-> ByteString m r

Decompressed stream

Decompress a streaming bytestring. WindowBits is from Codec.Compression.Zlib

decompress defaultWindowBits :: MonadIO m => ByteString m r -> ByteString m r

decompress' Source #

Arguments

:: MonadIO m 
=> WindowBits 
-> ByteString m r

Compressed byte stream

-> ByteString m (Either (ByteString m r) r)

Decompressed byte stream, ending with either leftovers or a result

Decompress a zipped byte stream, returning any leftover input that follows the compressed material.

compress Source #

Arguments

:: MonadIO m 
=> CompressionLevel 
-> WindowBits 
-> ByteString m r

Decompressed stream

-> ByteString m r

Compressed stream

Compress a byte stream.

See the Codec.Compression.Zlib module for details about CompressionLevel and WindowBits.

compress :: MonadIO m
         => CompressionLevel
         -> WindowBits
         -> ByteString m r
         -> ByteString m r

gunzip Source #

Arguments

:: MonadIO m 
=> ByteString m r

Compressed stream

-> ByteString m r

Decompressed stream

Decompress a gzipped byte stream.

gunzip :: MonadIO m
           => ByteString m r
           -> ByteString m r

gunzip' Source #

Arguments

:: MonadIO m 
=> ByteString m r

Compressed byte stream

-> ByteString m (Either (ByteString m r) r)

Decompressed bytes stream, returning either a ByteString of the leftover input or the return value from the input ByteString.

Decompress a gzipped byte stream, returning any leftover input that follows the compressed stream.

gzip Source #

Arguments

:: MonadIO m 
=> CompressionLevel 
-> ByteString m r

Decompressed stream

-> ByteString m r

Compressed stream

Compress a byte stream in the gzip format.

gzip :: MonadIO m
         => CompressionLevel
         -> ByteString m r
         -> ByteString m r

Compression levels

compressionLevel :: Int -> CompressionLevel Source #

A specific compression level between 0 and 9.

Window size

The following are re-exported from Codec.Compression.Zlib for your convenience.

defaultWindowBits :: WindowBits #

The default WindowBits is 15 which is also the maximum size.