Interface Transcoder

Transcoders provide functionality for converting values passed to and from the SDK to byte arrays and flags data that can be stored to the server.

interface Transcoder {
    decode(bytes, flags): any;
    encode(value): [Buffer, number];
}

Implemented by

Methods

Methods

  • Decodes a buffer and flags tuple back to the original type of the document.

    Parameters

    • bytes: Buffer

      The bytes that were previously encoded.

    • flags: number

      The flags associated with the data.

    Returns any

  • Encodes the specified value, returning a buffer and flags that are stored to the server and later used for decoding.

    Parameters

    • value: any

      The value to encode.

    Returns [Buffer, number]