Skip to main content

Stream Package Cheatsheet

Code-verified reference for packages/stream.

Core API

Transformation Methods

TransformationStream (Lazy Stream)

TransformationStream is emission-oriented:
  • getCompleted() returns the values emitted by the stream
  • completed streams retain emitted values in memory so they can be replayed
  • custom sinks on a reused Transformation are ignored
  • use Transformation::execute() / executeOn() when you need sink-specific completion results
Use predefined transformation:

Tee (Split One Stream Into Many)

Unused branches still count as active until they are released. Drop never-consumed branches promptly if another branch may run far ahead.

Source Facades

Array

Filesystem

CSV / JSONL

Text

HTTP Chunks

Transducers — Map

Transducers — Filter

Transducers — Limit

Transducers — Flatten

Transducers — Group

Transducers — Deduplicate

Transducers — Combine

Transducers — Accumulate

Transducers — Repeat

Transducers — Misc

Transducers — Result

Operates on Cognesy\Utils\Result\Result values (success/failure monads).

Common Sinks (Reducers)

Collection

Selection

Statistics

Boolean

Side Effects

Result Sinks

For streams of Cognesy\Utils\Result\Result objects:

Custom Transducer / Reducer