pipes-extra-0.2.0: Various basic utilities for Pipes.

Safe HaskellSafe-Infered

Control.Pipe.Binary

Contents

Synopsis

Handle and File IO

fileReader :: MonadIO m => FilePath -> Pipe () ByteString m ()Source

Read data from a file.

handleReader :: MonadIO m => Handle -> Pipe () ByteString m ()Source

Read data from an open handle.

fileWriter :: MonadIO m => FilePath -> Pipe ByteString Void m rSource

Write data to a file.

The file is only opened if some data arrives into the pipe.

handleWriter :: MonadIO m => Handle -> Pipe ByteString Void m rSource

Write data to a handle.

Chunked Byte Stream Manipulation

take :: Monad m => Int -> Pipe ByteString ByteString m ByteStringSource

Act as an identity for the first n bytes, then terminate returning the unconsumed portion of the last chunk.

takeWhile :: Monad m => (Word8 -> Bool) -> Pipe ByteString ByteString m ByteStringSource

Act as an identity as long as the given predicate holds, then terminate returning the unconsumed portion of the last chunk.

dropWhile :: Monad m => (Word8 -> Bool) -> Pipe ByteString ByteString m rSource

Drop bytes as long as the given predicate holds, then act as an identity.

lines :: Monad m => Pipe ByteString ByteString m rSource

Split the chunked input stream into lines, and yield them individually.

bytes :: Monad m => Pipe ByteString Word8 m rSource

Yield individual bytes of the chunked input stream.