method Stream.tap
Stream.tap(fn: (value: T) => Promisable<void>): Stream<T, E>

Runs a side-effect function on each successful value without transforming it. If the provided function throws an error or returns a rejected promise, the error will be collected and emitted as an error result in place of the original value.

Examples

Example 1

const stream = source.tap((value) => console.log("Got:", value));

Parameters

fn: (value: T) => Promisable<void>

Return Type

Stream<T, E>

Usage

import { type Stream } from ".";