readable-stream-polyfill
v0.0.0
Published
A [WHATWG-compliant](https://streams.spec.whatwg.org/#readablestream) polyfill for `ReadableStream` based on the eponymous implementation in Node.js.
Downloads
182
Readme
ReadableStream
A WHATWG-compliant polyfill for ReadableStream
based on the eponymous implementation in Node.js.
Install
npm install readable-stream-polyfill
Node.js API
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
// Polyfills the global "ReadableStream" class
// if it's not already implemented.
require('readable-stream-polyfill/globals')