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

Usage in Deno

```typescript import { ReadableBase } from "node:node__stream.d.ts"; ```
ReadableBase.prototype.map(
fn: (
data: any,
options?: Pick<ArrayOptions, "signal">,
) => any
,
options?: ArrayOptions,
): Readable
This method allows mapping over the stream. The *fn* function will be called for every chunk in the stream. If the *fn* function returns a promise - that promise will be `await`ed before being passed to the result stream.

Parameters

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

Return Type

Readable
a stream mapped with the function *fn*.