Skip to content

MeirionHughes/web-streams-extensions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

97 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WebStream Extensions

npm version Build Status codecov License: MIT

A collection helper methods for WebStreams, inspired by ReactiveExtensions.

Installation

npm install web-streams-extensions

Basic Usage

import { from, pipe, map, filter, toArray } from 'web-streams-extensions';

// Create a stream from an array and process it
const stream = pipe(
  from([1, 2, 3, 4, 5, 6]),
  filter(x => x % 2 === 0),  // Keep even numbers
  map(x => x * 2)            // Double them
);

const result = await toArray(stream);
console.log(result); // [4, 8, 12]

⚠️ReadableStreams are not recoverable. If you start and consume a stream, that instance cannot be reused.

API Reference

Browser Compatibility

This library requires support for:

  • ReadableStream (for all functionality)
  • WritableStream (for Subjects)
  • async/await (ES2017)

For older browsers, use the web-streams-polyfill:

import 'web-streams-polyfill/polyfill';
import { from, pipe, map } from 'web-streams-extensions';

Contributing

We welcome contributions! Please see our Contributing Guide for details.

About

helpers to create, change and pipe web-streams, like rxjs

Topics

Resources

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •