Package: effect
Module: Stream
Creates a new Stream from an iterable collection of values.
Details
chunkSize: Maximum number of values emitted per chunk.Example (Creating a stream from an iterable)
import { Console, Effect, Stream } from "effect"
const numbers = [1, 2, 3]
const program = Effect.gen(function*() {
const stream = Stream.fromIterable(numbers)
const values = yield* Stream.runCollect(stream)
yield* Console.log(values)
})
Effect.runPromise(program)
// Output: [ 1, 2, 3 ]
Signature
declare const fromIterable: <A>(iterable: Iterable<A>, options?: { readonly chunkSize?: number | undefined; }) => Stream<A>
Since v2.0.0