readable-buffer-stream

2.0.2 • Public • Published

readable-buffer-stream

js-standard-style Build Status Coverage Status

Create readable stream which stores data in Buffer.

Installation

npm install readable-buffer-stream

Usage

'use strict'
const BufferStream = require('readable-buffer-stream')
 
let bufferStream = new BufferStream()
 
bufferStream.on('data', (data) => {
  console.log(Buffer.isBuffer(data)) // true
})
 
bufferStream.put(new Buffer('buffer'))
bufferStream.put(new Buffer('another buffer'))

API

BufferStream({initialSize, chunkSize, incrementSize})

  • initialSize: Number initial size of inner buffer.
  • chunkSize: Number size of data in each data event.
  • incrementSize: Number size to increase when inner buffer do not have enough size.

Create a instance of BufferStream, which extends stream.Readable.

bufferStream.put(chunk)

  • buffer: Buffer data to be put in the bufferStream.

Put chunk in the inner buffer.

bufferStream.stop()

Stop the bufferStream.

Readme

Keywords

none

Package Sidebar

Install

npm i readable-buffer-stream

Weekly Downloads

0

Version

2.0.2

License

MIT

Last publish

Collaborators

  • qqqppp9998