Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@swimburger/isomorphic-streams

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@swimburger/isomorphic-streams

Isomorphic WHATWG Streams API package for browser, Node.js, and other runtimes. Forked from https://github.com/ksm2/isomorphic-streams

  • 1.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
19
increased by137.5%
Maintainers
1
Weekly downloads
 
Created
Source

This is a fork of https://github.com/ksm2/isomorphic-streams


isomorphic-streams

Build NPM version license

Isomorphic WHATWG Streams API package for browser, Node.js, and other runtimes.

This package has

  • zero dependencies
  • provides TypeScript typings
  • supports ReadableStream, WritableStream and TransformStream

Table of Contents

Install

Use either

yarn add isomorphic-streams

or

npm install isomorphic-streams

Usage

In the browser: Instead of using the global ReadbaleStream or window.ReadableStream, import from this package instead.

In Node.js: Instead of importing node:stream/web or requiring stream/web, import from this package instead.

The following code will work in both Node.js and the browser:

import { ReadableStream } from "isomorphic-streams";

const SECOND = 1000;

const stream = new ReadableStream({
  start(controller) {
    setInterval(() => {
      controller.enqueue(Date.now());
    }, SECOND);
  },
});

for await (const value of stream) {
  console.log(value);
}

More examples

Contributing

This project is open to feedback and contributions, please open an issue.

isomorphic-streams follows the Contributor Covenant Code of Conduct.

License

MIT © 2023 Niels Swimberghe, see LICENSE.

Keywords

FAQs

Package last updated on 29 Nov 2023

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc