HORIZON HASKELLDocslts/ghc-10.0.x8fef28d2026-11-02Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8fef28d · 2026-11-02

Moduleconduit-extra-1.3.8Haskell2010

Data.Conduit.Binary

NOTE It is recommended to start using Data.Conduit.Combinators instead of this module.

Functions for interacting with bytes.

For many purposes, it's recommended to use the conduit-combinators library, which provides a more complete set of functions.

Contents
  1. Files and Handles
  2. Sources
  3. Sinks
  4. Conduits
  5. Utilities
  6. Sources
  7. Sinks
  8. Storable
  9. Conduits
Synopsis

Files and Handles

Note that most of these functions live in the MonadResource monad to ensure resource finalization even in the presence of exceptions. In order to run such code, you will need to use runResourceT.

Sources

Same as sourceHandle, but instead of allocating a new buffer for each incoming chunk of data, reuses the same buffer. Therefore, the ByteStrings yielded by this function are not referentially transparent between two different yields.

This function will be slightly more efficient than sourceHandle by avoiding allocations and reducing garbage collections, but should only be used if you can guarantee that you do not reuse a ByteString (or any slice thereof) between two calls to await.

Sinks

Cautious version of sinkFile. The idea here is to stream the values to a temporary file in the same directory of the destination file, and only on successfully writing the entire file, moves it atomically to the destination path.

In the event of an exception occurring, the temporary file will be deleted and no move will be made. If the application shuts down without running exception handling (such as machine failure or a SIGKILL), the temporary file will remain and the destination file will be untouched.

valuesinkTempFile
  1. :: MonadResource m
  2. => FilePath

    temp directory

  3. -> String

    filename pattern

  4. -> ConduitM ByteString o m FilePath

Stream data into a temporary file in the given directory with the given filename pattern, and return the temporary filename. The temporary file will be automatically deleted when exiting the active ResourceT block, if it still exists.

Conduits

Stream the contents of the input to a Handle, and also send it along the pipeline. Similar in concept to the Unix command tee. Like sourceHandle, does not close the handle on completion. Related to: conduitFile.

Since 1.0.9

Utilities

Sources

Sinks

Storable

Conduits