Skip to content

k0nsti/browser-stream-util

Repository files navigation

npm License Typed with TypeScript bundlejs downloads GitHub Issues Build Status Styled with prettier Commitizen friendly Known Vulnerabilities Coverage Status

browser-stream-util

utility functions for web streams

API

Table of Contents

iteratorToStream

Converts an iterator into a ReadableStream.

Parameters

Returns ReadableStream

stringToStream

Encodes a string into a ReadableStream.

Parameters

Returns ReadableStream

uint8ToStream

Encodes a uint8 array into a ReadableStream.

Parameters

Returns ReadableStream

streamToString

Reads web stream content into a string.

Parameters

  • stream ReadableStream
  • decoder TextDecoder? (optional, default new TextDecoder())

Returns Promise<string>

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