Varint
Defined in: astrobase/src/varint/varint.ts:21
Parses a Protobuf style varint within binary.
Example
Section titled “Example”import { Varint } from '@astrobase/sdk/varint';
const bytes = new Uint8Array([233, 15]);const offset = 0;
const varint = new Varint(bytes, offset);
console.log(varint.value); // 2025Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Varint(
buffer,offset?):Varint
Defined in: astrobase/src/varint/varint.ts:22
Parameters
Section titled “Parameters”buffer
Section titled “buffer”Uint8Array
offset?
Section titled “offset?”number
Returns
Section titled “Returns”Varint
Accessors
Section titled “Accessors”encodingLength
Section titled “encodingLength”Get Signature
Section titled “Get Signature”get encodingLength():
number
Defined in: astrobase/src/varint/varint.ts:33
The number of bytes that the integer uses when encoded as varint.
Returns
Section titled “Returns”number
Get Signature
Section titled “Get Signature”get value():
number
Defined in: astrobase/src/varint/varint.ts:28
The integer value of the varint.
Returns
Section titled “Returns”number