effect-io-ai

Package: effect
Module: Stream

Stream.mkString

Concatenates all emitted strings into a single string.

Example (Joining strings from a stream)

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

const stream = Stream.make("Hello", " ", "World", "!")
const program = Effect.gen(function*() {
  const text = yield* Stream.mkString(stream)
  yield* Console.log(text)
})

Effect.runPromise(program)
// Hello World!

Signature

declare const mkString: <E, R>(self: Stream<string, E, R>) => Effect.Effect<string, E, R>

Source

Since v2.0.0