Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Serializer

Hierarchy

  • Serializer

Index

Constructors

Properties

coder: DataCoder
compressionLengthThreshold: number = 1024
options: SerializerPacketOptions
schemes: SerializerSchemes = {}
version: number = 3

Methods

  • deserialize<T>(buf: Buffer | Uint8Array): T
  • makePacket(config: SerializerPacketOptions, data: Buffer | Uint8Array, schema?: null | number): Buffer
  • Parameters

    • config: SerializerPacketOptions
    • data: Buffer | Uint8Array
    • schema: null | number = null

    Returns Buffer

  • registerSchema<T>(id: number, fields: T): void
  • serialize<T>(payload: T, schemaIdOrSchemaObject?: SerializerSchemaIdOrSchemaObject): Buffer
  • Type parameters

    • T: object = {}

    Parameters

    • payload: T
    • schemaIdOrSchemaObject: SerializerSchemaIdOrSchemaObject = null

    Returns Buffer

  • unregisterSchema(id: number): void
  • use(id: number, detector: Function, encode: (arg: any) => any, decode: (arg: any) => any): void
  • Parameters

    • id: number
    • detector: Function
    • encode: (arg: any) => any
        • (arg: any): any
        • Parameters

          • arg: any

          Returns any

    • decode: (arg: any) => any
        • (arg: any): any
        • Parameters

          • arg: any

          Returns any

    Returns void

Generated using TypeDoc