Functions for interacting with bytes.
- sourceFile :: ResourceIO m => FilePath -> Source m ByteString
- sourceHandle :: ResourceIO m => Handle -> Source m ByteString
- sourceFileRange :: ResourceIO m => FilePath -> Maybe Integer -> Maybe Integer -> Source m ByteString
- sinkFile :: ResourceIO m => FilePath -> Sink ByteString m ()
- sinkHandle :: ResourceIO m => Handle -> Sink ByteString m ()
- conduitFile :: ResourceIO m => FilePath -> Conduit ByteString m ByteString
- isolate :: Resource m => Int -> Conduit ByteString m ByteString
- openFile :: ResourceIO m => FilePath -> IOMode -> ResourceT m Handle
- head :: Resource m => Sink ByteString m (Maybe Word8)
- takeWhile :: Resource m => (Word8 -> Bool) -> Conduit ByteString m ByteString
- dropWhile :: Resource m => (Word8 -> Bool) -> Sink ByteString m ()
- take :: Resource m => Int -> Sink ByteString m ByteString
Documentation
sourceFile :: ResourceIO m => FilePath -> Source m ByteStringSource
Stream the contents of a file as binary data.
Since 0.0.0
sourceHandle :: ResourceIO m => Handle -> Source m ByteStringSource
Stream the contents of a Handle
as binary data. Note that this
function will not automatically close the Handle
when processing
completes, since it did not acquire the Handle
in the first place.
Since 0.0.2.
:: ResourceIO m | |
=> FilePath | |
-> Maybe Integer | Offset |
-> Maybe Integer | Maximum count |
-> Source m ByteString |
Stream the contents of a file as binary data, starting from a certain offset and only consuming up to a certain number of bytes.
Since 0.0.0
sinkFile :: ResourceIO m => FilePath -> Sink ByteString m ()Source
Stream all incoming data to the given file.
Since 0.0.0
sinkHandle :: ResourceIO m => Handle -> Sink ByteString m ()Source
Stream all incoming data to the given Handle
. Note that this function
will not automatically close the Handle
when processing completes.
Since 0.0.2.
conduitFile :: ResourceIO m => FilePath -> Conduit ByteString m ByteStringSource
Stream the contents of the input to a file, and also send it along the
pipeline. Similar in concept to the Unix command tee
.
Since 0.0.0
isolate :: Resource m => Int -> Conduit ByteString m ByteStringSource
Ensure that only up to the given number of bytes are consume by the inner sink. Note that this does not ensure that all of those bytes are in fact consumed.
Since 0.0.0
openFile :: ResourceIO m => FilePath -> IOMode -> ResourceT m HandleSource
Open a file Handle
safely by automatically registering a release
action.
While you are not required to call hClose
on the resulting handle, you
should do so as early as possible to free scarce resources.
Since 0.0.2
head :: Resource m => Sink ByteString m (Maybe Word8)Source
Return the next byte from the stream, if available.
Since 0.0.2
takeWhile :: Resource m => (Word8 -> Bool) -> Conduit ByteString m ByteStringSource
Return all bytes while the predicate returns True
.
Since 0.0.2
dropWhile :: Resource m => (Word8 -> Bool) -> Sink ByteString m ()Source
Ignore all bytes while the predicate returns True
.
Since 0.0.2
take :: Resource m => Int -> Sink ByteString m ByteStringSource
Take the given number of bytes, if available.
Since 0.0.3