0.0.0 • Published 2 years ago

readable-stream-polyfill v0.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

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')

Usage