ecluse:ecluse-core
Safe HaskellNone
LanguageGHC2021

Ecluse.Core.Stream

Description

Byte limits and whole-stream digests for advisory streams. Callers own the breach effect, so ingestion and runtime downloads can share the traversal without sharing error types.

Synopsis

Documentation

boundBytes :: Monad m => Int -> (Int -> m ()) -> ConduitT ByteString ByteString m () Source #

Pass chunks up to the byte cap. A breach hands the action the bytes seen and stops before the excess chunk, even if the action returns.

boundLines :: Monad m => Int -> (Int -> m ()) -> ConduitT ByteString ByteString m () Source #

Split a stream into lines, holding at most cap bytes of one. A longer line hands the action its length and stops, even if the action returns.

digestWhole :: forall (m :: Type -> Type). Monad m => ConduitT ByteString ByteString m ContentDigest Source #

Pass every chunk on and return their SHA-256 at the end. Fuse it with fuseBoth, which drains the source into the digest.