Options
All
  • Public
  • Public/Protected
  • All
Menu

This class provides logic to convert BigInt values to and from the UInt, Int, VarUInt, and VarInt primitives from the Ion spec.

Hierarchy

  • BigIntSerde

Index

Constructors

constructor

Methods

Static fromUnsignedBytes

  • fromUnsignedBytes(bytes: Uint8Array): bigint
  • Reads the provided byte array as a big-endian, unsigned integer.

    Parameters

    • bytes: Uint8Array

      A byte array containing an encoded UInt.

    Returns bigint

    A BigInt value representing the encoded UInt.

Static getUnsignedIntSizeInBytes

  • getUnsignedIntSizeInBytes(value: bigint): number

Static toSignedIntBytes

  • toSignedIntBytes(value: bigint, isNegative: boolean): Uint8Array
  • Encodes the specified BigInt value as a sign-and-magnitude integer.

    Parameters

    • value: bigint

      The integer to encode.

    • isNegative: boolean

      Whether or not the integer is negative. This cannot be inferred when value is zero, as the BigInt data type cannot natively represent negative zero.

    Returns Uint8Array

    A byte array containing the encoded Int.

Static toUnsignedIntBytes

  • toUnsignedIntBytes(value: bigint): Uint8Array
  • Encodes the specified BigInt value as a big-endian, unsigned integer.

    Parameters

    • value: bigint

      The BigInt value to encode.

    Returns Uint8Array

    A byte array containing the encoded UInt.