node-celaria-server
    Preparing search index...

    Class Packet

    I am a SmartBuffer wrapper for Celaria packet headers.

    Hierarchy

    • SmartBuffer
      • Packet
    Index

    Constructors

    • Parameters

      • packetType: number
      • Optionalprotocol: string

      Returns Packet

      TypeScript fields for protocol

    Properties

    encoding: BufferEncoding

    Sets the string encoding of the SmartBuffer instance.

    { BufferEncoding } The string Buffer encoding to set.

    internalBuffer: Buffer

    Gets the underlying internal Buffer. (This includes unmanaged data in the Buffer)

    The Buffer value.

    length: number
    packetType: number
    protocol: string
    readOffset: number

    Sets the read offset value of the SmartBuffer instance.

    { Number } - The offset value to set.

    writeOffset: number

    Sets the write offset value of the SmartBuffer instance.

    { Number } - The offset value to set.

    Methods

    • Clears the SmartBuffer instance to its original empty state.

      Returns SmartBuffer

    • Destroys the SmartBuffer instance.

      Returns SmartBuffer

    • Inserts a BigInt64BE value at the given offset value.

      Parameters

      • value: bigint

        { BigInt } The value to insert.

      • offset: number

        { Number } The offset to insert the value at.

      Returns SmartBuffer

      this

    • Inserts a Int64LE value at the given offset value.

      Parameters

      • value: bigint

        { BigInt } The value to insert.

      • offset: number

        { Number } The offset to insert the value at.

      Returns SmartBuffer

      this

    • Inserts a BigUInt64BE value at the given offset value.

      Parameters

      • value: bigint

        { Number } The value to insert.

      • offset: number

        { Number } The offset to insert the value at.

      Returns SmartBuffer

      this

    • Inserts a BigUInt64LE value at the given offset value.

      Parameters

      • value: bigint

        { Number } The value to insert.

      • offset: number

        { Number } The offset to insert the value at.

      Returns SmartBuffer

      this

    • Writes a Buffer to the current write position.

      Parameters

      • value: Buffer

        { Buffer } The Buffer to write.

      • offset: number

        { Number } The offset to write the Buffer to.

      Returns SmartBuffer

      this

    • Inserts a null-terminated Buffer.

      Parameters

      • value: Buffer

        { Buffer } The Buffer to write.

      • offset: number

        { Number } The offset to write the Buffer to.

      Returns SmartBuffer

      this

    • Inserts a DoubleBE value at the given offset value.

      Parameters

      • value: number

        { Number } The value to insert.

      • offset: number

        { Number } The offset to insert the value at.

      Returns SmartBuffer

      this

    • Inserts a DoubleLE value at the given offset value.

      Parameters

      • value: number

        { Number } The value to insert.

      • offset: number

        { Number } The offset to insert the value at.

      Returns SmartBuffer

      this

    • Inserts a FloatBE value at the given offset value.

      Parameters

      • value: number

        { Number } The value to insert.

      • offset: number

        { Number } The offset to insert the value at.

      Returns SmartBuffer

      this

    • Inserts a FloatLE value at the given offset value.

      Parameters

      • value: number

        { Number } The value to insert.

      • offset: number

        { Number } The offset to insert the value at.

      Returns SmartBuffer

      this

    • Inserts an Int16BE value at the given offset value.

      Parameters

      • value: number

        { Number } The value to insert.

      • offset: number

        { Number } The offset to insert the value at.

      Returns SmartBuffer

      this

    • Inserts an Int16LE value at the given offset value.

      Parameters

      • value: number

        { Number } The value to insert.

      • offset: number

        { Number } The offset to insert the value at.

      Returns SmartBuffer

      this

    • Inserts an Int32BE value at the given offset value.

      Parameters

      • value: number

        { Number } The value to insert.

      • offset: number

        { Number } The offset to insert the value at.

      Returns SmartBuffer

      this

    • Inserts an Int32LE value at the given offset value.

      Parameters

      • value: number

        { Number } The value to insert.

      • offset: number

        { Number } The offset to insert the value at.

      Returns SmartBuffer

      this

    • Inserts an Int8 value at the given offset value.

      Parameters

      • value: number

        { Number } The value to insert.

      • offset: number

        { Number } The offset to insert the value at.

      Returns SmartBuffer

      this

    • Inserts a String

      Parameters

      • value: string

        { String } The String value to insert.

      • offset: number

        { Number } The offset to insert the string at.

      • Optionalencoding: BufferEncoding

        { String } The BufferEncoding to use for writing strings (defaults to instance encoding).

      Returns SmartBuffer

      this

    • Inserts a null-terminated String.

      Parameters

      • value: string

        { String } The String value to write.

      • offset: number
      • Optionalencoding: BufferEncoding

        { String } The BufferEncoding to use for writing strings (defaults to instance encoding).

      Returns SmartBuffer

      this

    • Inserts an UInt16BE value at the given offset value.

      Parameters

      • value: number

        { Number } The value to insert.

      • offset: number

        { Number } The offset to insert the value at.

      Returns SmartBuffer

      this

    • Inserts an UInt16LE value at the given offset value.

      Parameters

      • value: number

        { Number } The value to insert.

      • offset: number

        { Number } The offset to insert the value at.

      Returns SmartBuffer

      this

    • Inserts an UInt32BE value at the given offset value.

      Parameters

      • value: number

        { Number } The value to insert.

      • offset: number

        { Number } The offset to insert the value at.

      Returns SmartBuffer

      this

    • Inserts an UInt32LE value at the given offset value.

      Parameters

      • value: number

        { Number } The value to insert.

      • offset: number

        { Number } The offset to insert the value at.

      Returns SmartBuffer

      this

    • Inserts an UInt8 value at the given offset value.

      Parameters

      • value: number

        { Number } The value to insert.

      • offset: number

        { Number } The offset to insert the value at.

      Returns SmartBuffer

      this

    • Reads a BigInt64BE value from the current read position or an optionally provided offset.

      Parameters

      • Optionaloffset: number

        { Number } The offset to read data from (optional)

      Returns bigint

    • Reads a BigInt64LE value from the current read position or an optionally provided offset.

      Parameters

      • Optionaloffset: number

        { Number } The offset to read data from (optional)

      Returns bigint

    • Reads a BigUInt64BE value from the current read position or an optionally provided offset.

      Parameters

      • Optionaloffset: number

        { Number } The offset to read data from (optional)

      Returns bigint

    • Reads a BigUInt64LE value from the current read position or an optionally provided offset.

      Parameters

      • Optionaloffset: number

        { Number } The offset to read data from (optional)

      Returns bigint

    • Reads a Buffer from the internal read position.

      Parameters

      • Optionallength: number

        { Number } The length of data to read as a Buffer.

      Returns Buffer

    • Reads a null-terminated Buffer from the current read poisiton.

      Returns Buffer

    • Reads an DoublEBE value from the current read position or an optionally provided offset.

      Parameters

      • Optionaloffset: number

        { Number } The offset to read data from (optional)

      Returns number

    • Reads an DoubleLE value from the current read position or an optionally provided offset.

      Parameters

      • Optionaloffset: number

        { Number } The offset to read data from (optional)

      Returns number

    • Reads an FloatBE value from the current read position or an optionally provided offset.

      Parameters

      • Optionaloffset: number

        { Number } The offset to read data from (optional)

      Returns number

    • Reads an FloatLE value from the current read position or an optionally provided offset.

      Parameters

      • Optionaloffset: number

        { Number } The offset to read data from (optional)

      Returns number

    • Reads an Int16BE value from the current read position or an optionally provided offset.

      Parameters

      • Optionaloffset: number

        { Number } The offset to read data from (optional)

      Returns number

    • Reads an Int16LE value from the current read position or an optionally provided offset.

      Parameters

      • Optionaloffset: number

        { Number } The offset to read data from (optional)

      Returns number

    • Reads an Int32BE value from the current read position or an optionally provided offset.

      Parameters

      • Optionaloffset: number

        { Number } The offset to read data from (optional)

      Returns number

    • Reads an Int32LE value from the current read position or an optionally provided offset.

      Parameters

      • Optionaloffset: number

        { Number } The offset to read data from (optional)

      Returns number

    • Reads an Int8 value from the current read position or an optionally provided offset.

      Parameters

      • Optionaloffset: number

        { Number } The offset to read data from (optional)

      Returns number

    • Reads a String from the current read position.

      Parameters

      • Optionalarg1: number | BufferEncoding

        { Number | String } The number of bytes to read as a String, or the BufferEncoding to use for the string (Defaults to instance level encoding).

      • Optionalencoding: BufferEncoding

        { String } The BufferEncoding to use for the string (Defaults to instance level encoding).

      Returns string

    • Reads a null-terminated String from the current read position.

      Parameters

      • Optionalencoding: BufferEncoding

        { String } The BufferEncoding to use for the string (Defaults to instance level encoding).

      Returns string

    • Reads an UInt16BE value from the current read position or an optionally provided offset.

      Parameters

      • Optionaloffset: number

        { Number } The offset to read data from (optional)

      Returns number

    • Reads an UInt16LE value from the current read position or an optionally provided offset.

      Parameters

      • Optionaloffset: number

        { Number } The offset to read data from (optional)

      Returns number

    • Reads an UInt32BE value from the current read position or an optionally provided offset.

      Parameters

      • Optionaloffset: number

        { Number } The offset to read data from (optional)

      Returns number

    • Reads an UInt32LE value from the current read position or an optionally provided offset.

      Parameters

      • Optionaloffset: number

        { Number } The offset to read data from (optional)

      Returns number

    • Reads an UInt8 value from the current read position or an optionally provided offset.

      Parameters

      • Optionaloffset: number

        { Number } The offset to read data from (optional)

      Returns number

    • Gets the remaining data left to be read from the SmartBuffer instance.

      Returns number

    • Gets the value of the internal managed Buffer (Includes managed data only)

      Returns Buffer

    • Gets the String value of the internal managed Buffer

      Parameters

      • Optionalencoding: BufferEncoding

        { String } The BufferEncoding to display the Buffer as (defaults to instance level encoding).

      Returns string

    • Parameters

      • protocol: string = ...

      Returns Buffer<ArrayBufferLike>

      Yet to be documented.

    • Writes a BigInt64BE value to the current write position (or at optional offset).

      Parameters

      • value: bigint

        { BigInt } The value to write.

      • Optionaloffset: number

        { Number } The offset to write the value at.

      Returns SmartBuffer

      this

    • Writes a BigInt64LE value to the current write position (or at optional offset).

      Parameters

      • value: bigint

        { BigInt } The value to write.

      • Optionaloffset: number

        { Number } The offset to write the value at.

      Returns SmartBuffer

      this

    • Writes a BigUInt64BE value to the current write position (or at optional offset).

      Parameters

      • value: bigint

        { Number } The value to write.

      • Optionaloffset: number

        { Number } The offset to write the value at.

      Returns SmartBuffer

      this

    • Writes a BigUInt64LE value to the current write position (or at optional offset).

      Parameters

      • value: bigint

        { Number } The value to write.

      • Optionaloffset: number

        { Number } The offset to write the value at.

      Returns SmartBuffer

      this

    • Writes a Buffer to the current write position.

      Parameters

      • value: Buffer

        { Buffer } The Buffer to write.

      • Optionaloffset: number

        { Number } The offset to write the Buffer to.

      Returns SmartBuffer

      this

    • Writes a null-terminated Buffer.

      Parameters

      • value: Buffer

        { Buffer } The Buffer to write.

      • Optionaloffset: number

        { Number } The offset to write the Buffer to.

      Returns SmartBuffer

      this

    • Writes a DoubleBE value to the current write position (or at optional offset).

      Parameters

      • value: number

        { Number } The value to write.

      • Optionaloffset: number

        { Number } The offset to write the value at.

      Returns SmartBuffer

      this

    • Writes a DoubleLE value to the current write position (or at optional offset).

      Parameters

      • value: number

        { Number } The value to write.

      • Optionaloffset: number

        { Number } The offset to write the value at.

      Returns SmartBuffer

      this

    • Writes a FloatBE value to the current write position (or at optional offset).

      Parameters

      • value: number

        { Number } The value to write.

      • Optionaloffset: number

        { Number } The offset to write the value at.

      Returns SmartBuffer

      this

    • Writes a FloatLE value to the current write position (or at optional offset).

      Parameters

      • value: number

        { Number } The value to write.

      • Optionaloffset: number

        { Number } The offset to write the value at.

      Returns SmartBuffer

      this

    • Writes an Int16BE value to the current write position (or at optional offset).

      Parameters

      • value: number

        { Number } The value to write.

      • Optionaloffset: number

        { Number } The offset to write the value at.

      Returns SmartBuffer

      this

    • Writes an Int16LE value to the current write position (or at optional offset).

      Parameters

      • value: number

        { Number } The value to write.

      • Optionaloffset: number

        { Number } The offset to write the value at.

      Returns SmartBuffer

      this

    • Writes an Int32BE value to the current write position (or at optional offset).

      Parameters

      • value: number

        { Number } The value to write.

      • Optionaloffset: number

        { Number } The offset to write the value at.

      Returns SmartBuffer

      this

    • Writes an Int32LE value to the current write position (or at optional offset).

      Parameters

      • value: number

        { Number } The value to write.

      • Optionaloffset: number

        { Number } The offset to write the value at.

      Returns SmartBuffer

      this

    • Writes an Int8 value to the current write position (or at optional offset).

      Parameters

      • value: number

        { Number } The value to write.

      • Optionaloffset: number

        { Number } The offset to write the value at.

      Returns SmartBuffer

      this

    • Writes a String

      Parameters

      • value: string

        { String } The String value to write.

      • Optionalarg2: number | BufferEncoding

        { Number | String } The offset to write the string at, or the BufferEncoding to use.

      • Optionalencoding: BufferEncoding

        { String } The BufferEncoding to use for writing strings (defaults to instance encoding).

      Returns SmartBuffer

      this

    • Writes a null-terminated String.

      Parameters

      • value: string

        { String } The String value to write.

      • Optionalarg2: number | BufferEncoding

        { Number | String } The offset to write the string to, or the BufferEncoding to use.

      • Optionalencoding: BufferEncoding

        { String } The BufferEncoding to use for writing strings (defaults to instance encoding).

      Returns SmartBuffer

      this

    • Writes an UInt16BE value to the current write position (or at optional offset).

      Parameters

      • value: number

        { Number } The value to write.

      • Optionaloffset: number

        { Number } The offset to write the value at.

      Returns SmartBuffer

      this

    • Writes an UInt16LE value to the current write position (or at optional offset).

      Parameters

      • value: number

        { Number } The value to write.

      • Optionaloffset: number

        { Number } The offset to write the value at.

      Returns SmartBuffer

      this

    • Writes an UInt32BE value to the current write position (or at optional offset).

      Parameters

      • value: number

        { Number } The value to write.

      • Optionaloffset: number

        { Number } The offset to write the value at.

      Returns SmartBuffer

      this

    • Writes an UInt32LE value to the current write position (or at optional offset).

      Parameters

      • value: number

        { Number } The value to write.

      • Optionaloffset: number

        { Number } The offset to write the value at.

      Returns SmartBuffer

      this

    • Writes an UInt8 value to the current write position (or at optional offset).

      Parameters

      • value: number

        { Number } The value to write.

      • Optionaloffset: number

        { Number } The offset to write the value at.

      Returns SmartBuffer

      this

    • Creates a new SmartBuffer instance with the provided Buffer and optional encoding.

      Parameters

      • buff: Buffer
      • Optionalencoding: BufferEncoding

        { String } The BufferEncoding to use for strings.

      Returns SmartBuffer

    • Creates a new SmartBuffer instance with the provided SmartBufferOptions options.

      Parameters

      • options: SmartBufferOptions

        { SmartBufferOptions } The options to use when creating the SmartBuffer instance.

      Returns SmartBuffer

    • Creates a new SmartBuffer instance with the provided internal Buffer size and optional encoding.

      Parameters

      • size: number

        { Number } The size of the internal Buffer.

      • Optionalencoding: BufferEncoding

        { String } The BufferEncoding to use for strings.

      Returns SmartBuffer

    • Type checking function that determines if an object is a SmartBufferOptions object.

      Parameters

      • options: SmartBufferOptions

      Returns options is SmartBufferOptions