Sign In

web-stream-transform

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

web-stream-transform

Functional transform helpers for Web Streams — map, filter, take, batch, and tap

latest
Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
3
Maintainers
1
Weekly downloads
 
Created
Source

web-stream-transform

Functional transform helpers for Web Streams — map, filter, take, batch, and tap

Install

npm install web-stream-transform

Usage

import {mapStream, filterStream, takeStream, batchStream, tapStream} from 'web-stream-transform';

const result = ReadableStream.from([1, 2, 3, 4, 5, 6])
	.pipeThrough(filterStream(x => x % 2 === 0))
	.pipeThrough(mapStream(x => x * 10))
	.pipeThrough(takeStream(2));
// Yields: 20, 40

API

mapStream(function_)

Returns a TransformStream that applies function_ to each chunk.

filterStream(function_)

Returns a TransformStream that only passes chunks where function_ returns true.

takeStream(count)

Returns a TransformStream that passes only the first count chunks then terminates.

batchStream(size)

Returns a TransformStream that collects chunks into arrays of size, flushing any remainder on close.

tapStream(function_)

Returns a TransformStream that calls function_ for side effects but passes chunks through unchanged.

  • node:stream/web - Node.js Web Streams API

License

MIT

Keywords

stream

FAQs

Package last updated on 16 Feb 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts