Buffer

Buffer is a subset of the Node.js Buffer.

Class Methods

Buffer.from(array)

  • array Number[]
  • Returns: Buffer

Creates a new Buffer instance from an array of bytes.

Buffer.from(string[,encoding='utf8'])

  • string String
  • encoding String
    • 'utf8' UTF-8 encoded string
    • 'hex' Hex encoded string
  • Returns: Buffer

Creates a new Buffer instance from an encoded string.

Buffer.isBuffer(buf)

  • buf Any
  • Returns: Boolean - Whether buf is a Buffer

Methods

Buffer#slice([start[,end]])

  • Returns: Buffer

Returns a new sliced Buffer.

Buffer#toString([encoding='utf8'])

  • encoding String
    • 'utf8' UTF-8 encoded string
    • 'hex' Hex encoded string
  • Returns: String

Returns an encoded string.

Buffer#indexOf([buf])

  • buf Buffer
  • Returns: Integer

Returns the index of the first occurrence of the given buf in the Buffer or -1 if no matches are found.

Buffer#valueOf()

  • Returns: String

Returns a string representation of the Buffer, such as <Buffer 00 01 02 03 04>.

Buffer#readInt8(offset[,noAssert=false])

  • offset Integer
  • noAssert Boolean
  • Returns: Integer

Buffer#readInt16BE(offset[,noAssert=false])

  • offset Integer
  • noAssert Boolean
  • Returns: Integer

Buffer#readInt32BE(offset[,noAssert=false])

  • offset Integer
  • noAssert Boolean
  • Returns: Integer

Buffer#readUInt8(offset[,noAssert=false])

  • offset Integer
  • noAssert Boolean
  • Returns: Integer

Buffer#readUInt16BE(offset[,noAssert=false])

  • offset Integer
  • noAssert Boolean
  • Returns: Integer

Buffer#readUInt32BE(offset[,noAssert=false])

  • offset Integer
  • noAssert Boolean
  • Returns: Integer

Properties

Buffer#length

  • Readonly: Integer - Length of the Buffer in bytes

results matching ""

    No results matching ""