Function decodeUint64

  • decodeUint64 produces an integer from a binary representation.

    Parameters

    • data: Uint8Array

      An typed array containing the big-endian encoding of an unsigned integer less than 2^64. This array must be at most 8 bytes long.

    • decodingMode: "safe"

      Configure how the integer will be decoded.

      The options are:

      • "safe": The integer will be decoded as a Number, but if it is greater than Number.MAX_SAFE_INTEGER an error will be thrown.
      • "mixed": The integer will be decoded as a Number if it is less than or equal to Number.MAX_SAFE_INTEGER, otherwise it will be decoded as a BigInt.
      • "bigint": The integer will always be decoded as a BigInt.

      Defaults to "safe" if not included.

    Returns number

    The integer that was encoded in the input data. The return type will be determined by the parameter decodingMode.

  • Parameters

    • data: Uint8Array
    • decodingMode: "mixed"

    Returns number | bigint

  • Parameters

    • data: Uint8Array
    • decodingMode: "bigint"

    Returns bigint

  • Parameters

    • data: Uint8Array

    Returns number

Generated using TypeDoc