Options
All
  • Public
  • Public/Protected
  • All
Menu

Class PooledBuffer

Package version

This class provides a buffer container which conceptually has no hard size limit. It accepts a capacity, an array of input buffers and the total length of input data. It will allocate an internal "buffer" of the capacity and fill the data in the input buffers into the internal "buffer" serially with respect to the total length. Then by calling PooledBuffer.getReadableStream(), you can get a readable stream assembled from all the data in the internal "buffer".

Hierarchy

  • PooledBuffer

Index

Constructors

Accessors

Methods

Constructors

constructor

  • new PooledBuffer(capacity: number): PooledBuffer
  • new PooledBuffer(capacity: number, buffers: Buffer[], totalLength: number): PooledBuffer

Accessors

size

  • get size(): number

Methods

fill

  • fill(buffers: Buffer[], totalLength: number): void
  • Fill the internal buffers with data in the input buffers serially with respect to the total length and the total capacity of the internal buffers. Data copied will be shift out of the input buffers.

    Parameters

    • buffers: Buffer[]

      Input buffers containing the data to be filled in the pooled buffer

    • totalLength: number

      Total length of the data to be filled in.

    Returns void

getReadableStream

  • getReadableStream(): Readable

Generated using TypeDoc