Class DefaultTranscoder

The default transcoder implements cross-sdk transcoding capabilities by taking advantage of the common flags specification to ensure compatibility. This transcoder is capable of encoding/decoding any value which is encodable to JSON, and additionally has special-case handling for Buffer objects.

Implements

Constructors

Methods

Constructors

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]