npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@stardazed/streams

v3.1.0

Published

Web Streams implementation

Downloads

29

Readme

@stardazed/streams

This library provides a full implementation of the web streams standard. It has no dependencies and can be used as a streams replacement in browsers without (full) support for the streams standard or in Node.

It also provides a full set of TypeScript types for the library as an improvement over the incomplete typings in the TS standard library.

Installation

npm install @stardazed/streams
pnpm install @stardazed/streams
yarn add @stardazed/streams

Usage

In a build system or runtime with module support:

// stream types
import { ReadableStream, WriteStream, TransformStream } from "@stardazed/streams";
// built-in strategies
import { ByteLengthQueuingStrategy, CountQueuingStrategy } from "@stardazed/streams";

In pre-modular Node:

// stream types
const { ReadableStream, WriteStream, TransformStream } = require("@stardazed/streams");
// built-in strategies
const { ByteLengthQueuingStrategy, CountQueuingStrategy } = require("@stardazed/streams");

See the Web Streams Standard Specification for documentation, examples, etc.

Compliance

This implementation passes all tests (as specified by January 2019) in the web platform tests except for the detached buffer tests as explained below and a few internal name check tests.

This is a good thing, but a number of tests in the suite are aimed mainly at browser engine internals or ordering of instructions strictly to the letter of the spec. This implementation may at any point deviate from certain spec tests for legibility or optimization purposes, but only if it's deemed worthwhile. (Actual browser implementations already do this as well.)

Limitations

Although the full streams API is implemented, this library's code lives in the client space and cannot directly be used with other built-in APIs. This includes calling getReader on the body of a fetch call, which may either not be implemented at all or return a browser internal ReadableStream. Due to implementation details of streams, you cannot mix and match the types in this implementation with those provided by the browser.

👉 The streams fetch adapter package can be used to create modified versions of fetch and Response to work with this or any other ReadableStream implementation.

👉 The Stardazed streams polyfill package provides a full replacement for streams, fetch and Response as a global polyfill. Use this if you just want a drop-in, make-it-work version of Stardazed streams.

In addition, while the BYOB variant of ReadableStream is implemented, buffers are copied and not transferred as no browser has implemented detached buffers yet, let alone exposed them to client-level code.

Copyright

© 2018-Present by @zenmumbler

License

MIT