Skip to content

convert a string/Buffer/Uint8Array to a readable stream, support highWaterMark and adjustable push delay

License

Notifications You must be signed in to change notification settings

Tarrowren/buffer-readable

Repository files navigation

buffer-readable

convert a string/Buffer/Uint8Array to a readable stream, support highWaterMark and adjustable push delay

Install

npm i buffer-readable

Example

import { BufferReadable } from "buffer-readable";

const stream = new BufferReadable("hello", { highWaterMark: 1, delay: 1000 });

for await (const chunk of stream) {
  // do sth
}

API

Class BufferReadable

new BufferReadable(buffer: string | Uint8Array | Buffer, opts?: BufferReadableOptions): BufferReadable
  • buffer: string | Uint8Array | Buffer
  • opts (Optional) : BufferReadableOptions

Interface BufferReadableOptions

  • delay (Optional) : number

    Delayed push, in milliseconds

License

MIT

About

convert a string/Buffer/Uint8Array to a readable stream, support highWaterMark and adjustable push delay

Resources

License

Stars

Watchers

Forks

Packages

No packages published