Skip to main content
ReadableBase.prototype.flatMap - node__stream.d.ts - Node documentation
method ReadableBase.prototype.flatMap

Usage in Deno

```typescript import { ReadableBase } from "node:node__stream.d.ts"; ```
ReadableBase.prototype.flatMap(
fn: (
data: any,
options?: Pick<ArrayOptions, "signal">,
) => any
,
options?: ArrayOptions,
): Readable
This method returns a new stream by applying the given callback to each chunk of the stream and then flattening the result. It is possible to return a stream or another iterable or async iterable from *fn* and the result streams will be merged (flattened) into the returned stream.

Parameters

fn: (
data: any,
options?: Pick<ArrayOptions, "signal">,
) => any
a function to map over every chunk in the stream. May be async. May be a stream or generator.
optional
options: ArrayOptions

Return Type

Readable
a stream flat-mapped with the function *fn*.