buffer-readable
v1.0.3
Published
convert a string/Buffer/Uint8Array to a readable stream, support highWaterMark and adjustable push delay
Downloads
8
Maintainers
Readme
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 | Bufferopts
(Optional) : BufferReadableOptions
Interface BufferReadableOptions
delay
(Optional) : numberDelayed push, in milliseconds
License
MIT