![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@yume-chan/stream-extra
Advanced tools
Some useful extensions for working with binary streams. Conforms to the Web Streams API.
If all of ReadableStream
, WritableStream
and TransformStream
fields are available on globalThis
, they will be used. Otherwise, the web-streams-polyfill package will be used.
Google Chrome 89 and Mozilla Firefox 102 provide full support for Web Streams API natively.
In Node.js, it's not possible to load the stream/web
module while keeping the compatibility with both Web and bundlers:
module
module, thus requires a shim in import map.Assigning ReadableStream
, WritableStream
and TransformStream
from stream/web
module to globalThis
, before loading this library, will still work. Other custom polyfill can also be loaded this way.
ReadableStream#pipeTo
and ReadableStream#pipeThrough
The Web Streams API spec specifies that ReadableStream#pipeTo
must check the argument to be an instance of WritableStream
, so it can optimize the performance by calling internal methods directly.
Native implementations will perform this check, so new globalThis.ReadableStream().pipeTo(new Polyfill.WritableStream())
will throw an error.
The WrapReadableStream
class can be used to bypass this check:
import { WrapReadableStream } from "@yume-chan/stream-extra";
import { WritableStream as PolyfillWritableStream } from "web-streams-polyfill";
const nativeReadable = new globalThis.ReadableStream();
const wrappedReadable = new WrapReadableStream(new globalThis.ReadableStream());
nativeReadable.pipeTo(new PolyfillWritableStream()); // Error
wrappedReadable.pipeTo(new PolyfillWritableStream()); // OK
web-streams-polyfill package's ReadableStream#pipeTo
only uses public methods, so it can be used with any WritableStream
implementation.
BufferedReadableStream
Allowing reading specified amount of data by buffering incoming data.
It's not a Web Streams API ReadableStream
, because ReadableStream
doesn't allow hinting the desired read size (except using BYOB readable, but causes extra allocations for small reads).
FAQs
Extensions to Web Streams API
We found that @yume-chan/stream-extra demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.