
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
@stardazed/streams
Advanced tools
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.
npm install @stardazed/streams
pnpm install @stardazed/streams
yarn add @stardazed/streams
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.
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.)
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.
© 2018-Present by @zenmumbler
MIT
FAQs
Web Streams implementation
The npm package @stardazed/streams receives a total of 256 weekly downloads. As such, @stardazed/streams popularity was classified as not popular.
We found that @stardazed/streams demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.