Function decode

  • Decode a value from the MessagePack binary format.

    If the input is not in valid message pack format, an error will be thrown.

    Parameters

    • data: Uint8Array

      MessagePack binary data.

    Returns ValueType

    Decoded value from the MessagePack binary data.

    import { decode } from "@std/msgpack/decode";
    import { assertEquals } from "@std/assert";

    const encoded = new Uint8Array([163, 72, 105, 33]);

    assertEquals(decode(encoded), "Hi!");