See the simple examples of use
here and the
ghci
examples especially in
Streaming.ByteString.Char8. We begin
with a slight modification of the documentation to
Data.ByteString.Lazy:
A time and space-efficient implementation of effectful byte streams
using a stream of packed
Word8 arrays, suitable for high
performance use, both in terms of large data quantities, or high speed
requirements. Streaming ByteStrings are encoded as streams of strict
chunks of bytes.
A key feature of streaming ByteStrings is the means to manipulate
large or unbounded streams of data without requiring the entire
sequence to be resident in memory. To take advantage of this you have
to write your functions in a streaming style, e.g. classic pipeline
composition. The default I/O chunk size is 32k, which should be good
in most circumstances.
Some operations, such as
concat,
append, and
cons, have better complexity than their
Data.ByteString
equivalents, due to optimisations resulting from the list spine
structure. For other operations streaming, like lazy, ByteStrings are
usually within a few percent of strict ones.
This module is intended to be imported
qualified, to avoid
name clashes with
Prelude functions. eg.
import qualified Streaming.ByteString as Q
Original GHC implementation by Bryan O'Sullivan. Rewritten to use
UArray by Simon Marlow. Rewritten to support slices and use
ForeignPtr by David Roundy. Rewritten again and extended by Don
Stewart and Duncan Coutts. Lazy variant by Duncan Coutts and Don
Stewart. Streaming variant by Michael Thompson, following the ideas of
Gabriel Gonzales' pipes-bytestring.