@tgsnake/skema
    Preparing search index...

    Class Long

    Serializer and deserializer for 64-bit (8-byte) signed or unsigned integers.

    In MTProto, 64-bit integers are heavily used for message IDs, session IDs, chat IDs, and salt values. Because standard JS numbers only support safe integers up to 53 bits, this class operates on native JavaScript bigint values.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    _slots: string[]

    The internal slot list storing serialization field property names.

    className: string

    The canonical string name of this class representation.

    classType: string

    The underlying classification type (e.g. request, constructor, function).

    cls: any = ...

    A dynamic reference to the current subclass constructor. Enables late static binding for instance methods to access static helper operations.

    constructorId: number

    The unique 32-bit integer identifier (CRC32 checksum) of this TL constructor.

    subclassOfId: number

    The unique 32-bit integer identifier of the parent/abstract type this TL subclass represents.

    SIZE: number = 8

    The byte size of a 64-bit long integer (8 bytes).

    Methods

    • Deserializes a binary stream into this specific TLObject instance.

      Parameters

      • data: BytesIO

        The BytesIO buffer stream containing the serialized TLObject.

      • ...args: any[]

        Additional arguments passed down to the read parser.

      Returns Promise<any>

      A promise resolving to the parsed instance.

    • Serializes the TLObject instance to a clean JSON-compatible representation.

      Returns { [key: string]: any }

      A plain object containing class attributes and values.

      Correctly stringifies extremely large fields (e.g. bigints) that are normally not serializable in standard JSON.stringify calls.

    • Formats the TLObject into a structured string.

      Returns string

      A string starting with the constructor name followed by a pretty JSON payload.

    • Serializes the current class instance into a raw binary buffer.

      Parameters

      • ...args: any[]

        Arguments passed down to the writer.

      Returns Buffer

      A Buffer containing the serialized representation of this object.

    • Reads and decodes a 64-bit integer from a binary stream.

      Parameters

      • data: BytesIO

        The BytesIO stream to read the long integer from.

      • signed: boolean = true

        Set to true to parse as a signed integer; set to false for unsigned. Defaults to true.

      • little: boolean = true

        Set to true to read in little-endian format; set to false for big-endian. Defaults to true.

      • size: number = Long.SIZE

        The exact number of bytes to read from the stream. Defaults to Long.SIZE.

      Returns Promise<bigint>

      A promise resolving to the decoded native bigint.

    • Serializes a 64-bit integer value into a Buffer.

      Parameters

      • value: bigint

        The native bigint value to serialize.

      • signed: boolean = true

        Set to true if the integer is signed; set to false if unsigned. Defaults to true.

      • little: boolean = true

        Set to true to write in little-endian format; set to false for big-endian. Defaults to true.

      Returns Buffer

      A Buffer containing the 8-byte representation of the 64-bit integer.