1.3.4 • Published 10 months ago
browser-stream-util v1.3.4
browser-stream-util
utility functions for web streams
API
Table of Contents
iteratorToStream
Converts an iterator into a ReadableStream.
Parameters
iterator(AsyncIterator[Uint8Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) | Iterator[Uint8Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array))
Returns ReadableStream
stringToStream
Encodes a string into a ReadableStream.
Parameters
strstringencoderTextEncoder? (optional, defaultnew TextEncoder())
Returns ReadableStream
uint8ToStream
Encodes a uint8 array into a ReadableStream.
Parameters
arrayUint8Array
Returns ReadableStream
streamToString
Reads web stream content into a string.
Parameters
streamReadableStreamdecoderTextDecoder? (optional, defaultnew TextDecoder())
Returns Promise[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)
streamToUint8Array
Reads web stream content into a Uint8Array.
Parameters
streamReadableStream
Returns Promise[Uint8Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array)
emptyStream
Delivers a zero length ReadableStream with no data.
Returns ReadableStream
install
With npm do:
npm install browser-stream-utillicense
BSD-2-Clause