browser-stream-util
v1.3.7
Published
utility functions for web streams
Downloads
9,347
Readme
browser-stream-util
utility functions for web streams
API
Table of Contents
- iteratorToStream
- stringToStream
- uint8ToStream
- streamToString
- streamToUint8Array
- streamToUint8Array
- emptyStream
iteratorToStream
Converts an iterator into a ReadableStream.
Parameters
iterator(AsyncIterator<Uint8Array> | Iterator<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())
streamToUint8Array
Reads web stream content into a Uint8Array.
Parameters
streamReadableStreammaxByteLengthnumber
Returns Promise<Uint8Array>
streamToUint8Array
Reads web stream content into a Uint8Array.
Parameters
streamReadableStream
Returns Promise<Uint8Array>
emptyStream
Delivers a zero length ReadableStream with no data.
Returns ReadableStream
install
With npm do:
npm install browser-stream-utillicense
BSD-2-Clause
