Class: BufferReader

BufferReader

Wire format reader using node buffers.

new BufferReader(buffer)

Constructs a new buffer reader instance.

Name Type Description
buffer Buffer

Buffer to read from

Extends

Members

buf { Uint8Array }

Read buffer.

len { number }

Read buffer length.

pos { number }

Read buffer position.

Methods

inherited bool(){ boolean }

Reads a varint as a boolean.

Returns:
Type Description
boolean Value read

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

Returns:
Type Description
Buffer Value read

inherited double(){ number }

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

Returns:
Type Description
number Value read

inherited fixed32(){ number }

Reads fixed 32 bits as an unsigned 32 bit integer.

Returns:
Type Description
number Value read

Reads fixed 64 bits.

Returns:
Type Description
Long Value read

inherited float(){ number }

Reads a float (32 bit) as a number.

Returns:
Type Description
number Value read

inherited int32(){ number }

Reads a varint as a signed 32 bit value.

Returns:
Type Description
number Value read

Reads a varint as a signed 64 bit value.

Returns:
Type Description
Long Value read

inherited sfixed32(){ number }

Reads fixed 32 bits as a signed 32 bit integer.

Returns:
Type Description
number Value read

Reads zig-zag encoded fixed 64 bits.

Returns:
Type Description
Long Value read

inherited sint32(){ number }

Reads a zig-zag encoded varint as a signed 32 bit value.

Returns:
Type Description
number Value read

Reads a zig-zag encoded varint as a signed 64 bit value.

Returns:
Type Description
Long Value read

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

Name Type Description
length number optional

Length if known, otherwise a varint is assumed

Returns:
Type Description
Reader this

inherited skipType(wireType){ Reader }

Skips the next element of the specified wire type.

Name Type Description
wireType number

Wire type received

Returns:
Type Description
Reader this

inherited string(){ string }

Reads a string preceeded by its byte length as a varint.

Returns:
Type Description
string Value read

inherited uint32(){ number }

Reads a varint as an unsigned 32 bit value.

Returns:
Type Description
number Value read

Reads a varint as an unsigned 64 bit value.

Returns:
Type Description
Long Value read