@tgsnake/skema
    Preparing search index...

    Class Bool

    Dynamic dispatcher class representing MTProto abstract boolean values.

    In MTProto, boolean values are represented as explicit class instances (BoolTrue or BoolFalse) rather than raw bits or primitive bytes. This class coordinates dynamic serialization and deserialization between native JavaScript boolean values (true/false) and the corresponding MTProto constructors.

    const buffer = Bool.write(true); // Serializes `true` to a Buffer using BoolTrue
    const val = await Bool.read(bytesIO); // Deserializes from stream to native boolean

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    _slots: string[]

    The internal slot list storing serialization field property names.

    className: string = 'Bool'

    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.

    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 a 32-bit boolean constructor identifier from the stream and resolves it to a native boolean.

      Parameters

      • data: BytesIO

        The BytesIO stream to read from.

      • ..._arg: any[]

        Unused arguments.

      Returns Promise<boolean>

      A promise resolving to the decoded boolean value.

    • Serializes a native JS boolean value into a Buffer using the appropriate constructor.

      Parameters

      • value: boolean

        The boolean value to serialize.

      Returns Buffer

      A Buffer containing the serialized BoolTrue or BoolFalse representation.