Counter of the required number of bytes to encode a given object.

Used as a pre-pass before using TlBinaryWriter to avoid unnecessary allocations.

Constructors

Properties

count: number = 0
objectMap: TlWriterMap

Writers map

Methods

  • Parameters

    • fn: ((item: unknown) => void)
        • (item): void
        • Parameters

          • item: unknown

          Returns void

    • items: unknown[]

    Returns void

  • Count overhead in bytes for the given number of bytes when encoded as bytes TL type.

    Parameters

    • size: number

      Number of bytes

    Returns number

  • Count bytes required to serialize the given object.

    Parameters

    • objectMap: TlWriterMap

      Writers map

    • obj: {
          _: string;
      }

      Object to count bytes for

      • _: string

    Returns number