browser-stream-util
v1.3.2
Published
utility functions for web streams
Downloads
8,660
Readme
browser-stream-util
utility functions for web streams
API
Table of Contents
iteratorToStream
Converts an iterator into a ReadableStream.
Parameters
iterator
(AsyncIterator<Uint8Array> | Iterator<Uint8Array>)
Returns ReadableStream
stringToStream
Encodes a string into a ReadableStream.
Parameters
str
stringencoder
TextEncoder? (optional, defaultnew TextEncoder()
)
Returns ReadableStream
uint8ToStream
Encodes a uint8 array into a ReadableStream.
Parameters
array
Uint8Array
Returns ReadableStream
streamToString
Reads web stream content into a string.
Parameters
stream
ReadableStreamdecoder
TextDecoder? (optional, defaultnew TextDecoder()
)
streamToUint8Array
Reads web stream content into a Uint8Array.
Parameters
stream
ReadableStream
Returns Promise<Uint8Array>
emptyStream
Delivers a zero length ReadableStream with no data.
Returns ReadableStream
install
With npm do:
npm install browser-stream-util
license
BSD-2-Clause