Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kettanaito/readable-stream-polyfill
"ReadableStream" polyfill based on the eponymous implementation from Node.js.
https://github.com/kettanaito/readable-stream-polyfill
controller nodejs polyfill readable readablestream stream
Last synced: 1 day ago
JSON representation
"ReadableStream" polyfill based on the eponymous implementation from Node.js.
- Host: GitHub
- URL: https://github.com/kettanaito/readable-stream-polyfill
- Owner: kettanaito
- Created: 2022-06-14T16:18:24.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-06-14T23:32:23.000Z (over 2 years ago)
- Last Synced: 2024-05-22T16:23:46.721Z (5 months ago)
- Topics: controller, nodejs, polyfill, readable, readablestream, stream
- Language: TypeScript
- Homepage: https://npmjs.com/package/readable-stream-polyfill
- Size: 46.9 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# `ReadableStream`
A [WHATWG-compliant](https://streams.spec.whatwg.org/#readablestream) polyfill for `ReadableStream` based on the eponymous implementation in Node.js.
## Install
```sh
npm install readable-stream-polyfill
```## Node.js API
```js
const { ReadableStream } = require('readable-stream-polyfill')const stream = new ReadableStream({
start(controller) {
controller.enqueue('hello')
controller.enqueue('world')
controller.end()
},
})const reader = await stream.getReader()
```## Polyfill
```js
// Polyfills the global "ReadableStream" class
// if it's not already implemented.
require('readable-stream-polyfill/globals')
```## Usage
- [`ReadableStream` on MDN](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream)