src/utils/reader.js
function BufferReader(data, zeroCopy) {
  if (!(this instanceof BufferReader))
    return new BufferReader(data, zeroCopy);

  assert(Buffer.isBuffer(data), 'Must pass a Buffer.');

  this.data = data;
  this.offset = 0;
  this.zeroCopy = zeroCopy || false;
  this.stack = [];
}
function BufferReader(data, zeroCopy) {
  if (!(this instanceof BufferReader))
    return new BufferReader(data, zeroCopy);

  assert(Buffer.isBuffer(data), 'Must pass a Buffer.');

  this.data = data;
  this.offset = 0;
  this.zeroCopy = zeroCopy || false;
  this.stack = [];
}
function BufferReader ( data , zeroCopy ) { if ( ! ( this instanceof BufferReader ) ) return new BufferReader ( data , zeroCopy ) ; assert ( Buffer . isBuffer ( data ) , 'Must pass a Buffer.' ) ; this . data = data ; this . offset = 0 ; this . zeroCopy = zeroCopy || false ; this . stack = [ ] ; }
An object that allows reading of buffers in a sane manner.
@alias module:utils.BufferReader
@constructor
@param {Buffer} data
@param {Boolean?} zeroCopy - Do not reallocate buffers when
slicing. Note that this can lead to memory leaks if not used
carefully.
An object that allows reading of buffers in a sane manner .