effect-io-ai

Package: effect
Module: Stream

Stream.chunks

Exposes the underlying chunks as a stream of non-empty arrays.

Example (Exposing stream chunks)

import { Console, Effect, Stream } from "effect"

const program = Effect.gen(function*() {
  const chunks = yield* Stream.make(1, 2, 3, 4).pipe(
    Stream.rechunk(2),
    Stream.chunks,
    Stream.runCollect
  )
  yield* Console.log(chunks)
})

Effect.runPromise(program)
// Output: [ [ 1, 2 ], [ 3, 4 ] ]

Signature

declare const chunks: <A, E, R>(self: Stream<A, E, R>) => Stream<Arr.NonEmptyReadonlyArray<A>, E, R>

Source

Since v2.0.0