1.2.0 • Published 3 months ago

browser-stream-util v1.2.0

Weekly downloads
-
License
BSD-2-Clause
Repository
github
Last release
3 months ago

npm Typed with TypeScript License 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 web stream.

Parameters

Returns ReadableStream

stringToStream

Encodes a string into a web stream.

Parameters

Returns ReadableStream

uint8ToStream

Encodes a uint8 array into a web stream.

Parameters

Returns ReadableStream

streamToString

Reads web stream content into a string.

Parameters

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

Returns Promise[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)

streamToUint8Array

Reads web stream content into a Uint8Array.

Parameters

  • stream ReadableStream

Returns Promise[Uint8Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array)

emptyStream

Delivers a zero length web stream with no data.

Returns ReadableStream

install

With npm do:

npm install browser-stream-util

license

BSD-2-Clause