Function decodeHex

  • Decodes the given hex-encoded string. If the input is malformed, an error is thrown.

    Parameters

    • src: string

      The hex-encoded string to decode.

    Returns Uint8Array_

    The decoded data.

    import { decodeHex } from "@std/encoding/hex";
    import { assertEquals } from "@std/assert";

    assertEquals(
    decodeHex("616263"),
    new TextEncoder().encode("abc"),
    );