pamoja for TypeScript - v0.2.0
    Preparing search index...

    Class Quantizer

    Packs float readings to a fixed precision for a metered link.

    Index
    • Creates a quantizer whose scale sets the precision kept.

      A scale of 100 keeps two decimal places. It must be positive and finite, and decoding must use the same scale the batch was encoded with.

      Parameters

      • scale: number

      Returns Quantizer

    • Decodes a batch back into readings, to within the quantizer's precision.

      Parameters

      • bytes: Buffer

      Returns number[]

    • Quantizes and delta-encodes a batch of readings.

      A reading that is not a number, is infinite, or is too large for the scale is refused, since the format has no way to carry a missing reading.

      Parameters

      • readings: number[]

      Returns Buffer