effect-io-ai

Package: effect
Module: Stream

Stream.fromIterable

Creates a new Stream from an iterable collection of values.

Example

import { Effect, Stream } from "effect"

const numbers = [1, 2, 3]

const stream = Stream.fromIterable(numbers)

Effect.runPromise(Stream.runCollect(stream)).then(console.log)
// { _id: 'Chunk', values: [ 1, 2, 3 ] }

Signature

declare const fromIterable: <A>(iterable: Iterable<A>) => Stream<A>

Source

Since v2.0.0