@tgsnake/skema
    Preparing search index...

    Class GzipPacked

    Represents a Gzip-compressed wrapper around another serialized TLObject payload.

    Telegram MTProto automatically packages certain large responses or bulk payloads within a gzip_packed constructor to optimize bandwidth and network performance. This class handles the transparent zlib-based compression and decompression of these payloads.

    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.

    packedData: TLObject

    The underlying inner deserialized TLObject that was compressed.

    subclassOfId: number

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

    ID: number = 0x3072cfa1

    The unique class ID identifier representing GzipPacked (0x3072cfa1).

    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 and zlib-compresses the inner TLObject into a raw binary buffer.

      Returns Buffer

      A Buffer representing the compressed MTProto binary structure.

      Serializes the payload by first writing the 32-bit GzipPacked.ID identifier, followed by the length-prefixed zlib-compressed buffer containing the inner TLObject's binary output.

    • Reads, decompresses, and deserializes a Gzip-packed payload from a binary stream.

      Parameters

      • data: BytesIO

        The BytesIO stream containing the compressed gzip_packed data structure.

      • ..._args: any[]

        Unused additional parameters.

      Returns Promise<GzipPacked>

      A promise resolving to the decompressed GzipPacked instance wrapping the deserialized object.

      This method:

      1. Reads the length-prefixed compressed bytes from the input stream.
      2. Runs native zlib gunzip (gunzipSync) on the compressed data.
      3. Wraps the raw uncompressed bytes inside a new BytesIO stream.
      4. Recursively parses the decompressed buffer as a valid TLObject.
    • Serializes constructor arguments into a raw binary buffer.

      Parameters

      • ..._args: any[]

        Arguments to be serialized.

      Returns Buffer

      An empty Buffer of size 0.

      This base implementation acts as an abstract stub returning an empty Buffer. Subclasses override this static method to handle specific binary serialization layouts.