2.0.2 • Published 8 years ago

readable-buffer-stream v2.0.2

Weekly downloads
7
License
MIT
Repository
github
Last release
8 years ago

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.

2.0.2

8 years ago

2.0.1

8 years ago

2.0.0

8 years ago

1.0.0

8 years ago