Options
All
  • Public
  • Public/Protected
  • All
Menu

Wire format reader using Uint8Array if available, otherwise Array.

Hierarchy

Index

Constructors

  • Constructs a new reader instance using the specified buffer.

    Parameters

    Returns Reader

Properties

Read buffer.

len: number

Read buffer length.

pos: number

Read buffer position.

Methods

  • bool(): boolean
  • Reads a varint as a boolean.

    Returns boolean

    Value read

  • Reads a sequence of bytes preceeded by its length as a varint.

    Returns internal.Uint8Array

    Value read

  • double(): number
  • Reads a double (64 bit float) as a number.

    Returns number

    Value read

  • fixed32(): number
  • Reads fixed 32 bits as an unsigned 32 bit integer.

    Returns number

    Value read

  • fixed64(): Long
  • Reads fixed 64 bits.

    Returns Long

    Value read

  • float(): number
  • Reads a float (32 bit) as a number.

    Returns number

    Value read

  • int32(): number
  • Reads a varint as a signed 32 bit value.

    Returns number

    Value read

  • int64(): Long
  • Reads a varint as a signed 64 bit value.

    Returns Long

    Value read

  • sfixed32(): number
  • Reads fixed 32 bits as a signed 32 bit integer.

    Returns number

    Value read

  • sfixed64(): Long
  • Reads zig-zag encoded fixed 64 bits.

    Returns Long

    Value read

  • sint32(): number
  • Reads a zig-zag encoded varint as a signed 32 bit value.

    Returns number

    Value read

  • sint64(): Long
  • Reads a zig-zag encoded varint as a signed 64 bit value.

    Returns Long

    Value read

  • Skips the specified number of bytes if specified, otherwise skips a varint.

    Parameters

    • Optional length: number

    Returns Reader

    this

  • skipType(wireType: number): Reader
  • Skips the next element of the specified wire type.

    Parameters

    • wireType: number

      Wire type received

    Returns Reader

    this

  • string(): string
  • Reads a string preceeded by its byte length as a varint.

    Returns string

    Value read

  • uint32(): number
  • Reads a varint as an unsigned 32 bit value.

    Returns number

    Value read

  • uint64(): Long
  • Reads a varint as an unsigned 64 bit value.

    Returns Long

    Value read

  • Creates a new reader using the specified buffer.

    throws

    {Error} If buffer is not a valid buffer

    Parameters

    Returns Reader | BufferReader

    A BufferReader if buffer is a Buffer, otherwise a Reader

Generated using TypeDoc