A collection of utility functions for dealing with
- mapE :: (ByteString -> ByteString) -> Enumerator -> Enumerator
- toLBS :: Enumerator -> IO ByteString
- fromLBS :: ByteString -> Enumerator
- fromLBS' :: IO ByteString -> Enumerator
- toSource :: Enumerator -> IO Source
- fromHandle :: Handle -> Enumerator
- fromFile :: FilePath -> Enumerator
- fromEitherFile :: Either FilePath Enumerator -> Enumerator
- buffer :: Enumerator -> Enumerator
Performs a specified conversion on each
ByteString output by an
Lazy byte strings
unsafeInterleaveIO to lazily read from an enumerator. All
normal lazy I/O warnings apply. In addition, since it is based on
toSource, please observe all precautions for that function.
This function safely converts a lazy bytestring into an enumerator.
fromLBS, but the lazy bytestring is in the IO monad. This allows
you to lazily read a file into memory, perform some mapping on the data and
convert it into an enumerator.
This function uses another thread to convert an
Enumerator to a
Source. In essence, this allows you to write code which "pulls" instead
of code which is pushed to. While this can be a useful technique, some
- It will be more resource heavy than using the
- You *must* consume all input. If you do not, then the other thread will be deadlocked.
Read a chunk of data from the given
Handle at a time. We use
defaultChunkSize from the bytestring package to determine the largest
chunk to take.
A little wrapper around
fromHandle which first opens a file for reading.