web-stream-kit
    Preparing search index...

    Class MapStream<I, O>

    A TransformStream that applies a synchronous or asynchronous mapping function to each chunk.

    const doubled = numbersStream.pipeThrough(
    new MapStream((n: number) => n * 2)
    );

    Type Parameters

    • I

      Input stream chunk type.

    • O

      Output stream chunk type.

    Hierarchy

    • TransformStream<I, O>
      • MapStream
    Index
    • Constructs a new MapStream.

      Type Parameters

      • I

        Input stream chunk type.

      • O

        Output stream chunk type.

      Parameters

      • fn: MapFunction<I, O>

        The mapping function applied to each incoming item.

      Returns MapStream<I, O>

    readable: ReadableStream<O>

    The readable read-only property of the TransformStream interface returns the ReadableStream instance controlled by this TransformStream.

    MDN Reference

    writable: WritableStream<I>

    The writable read-only property of the TransformStream interface returns the WritableStream instance controlled by this TransformStream.

    MDN Reference