decodeHex

import { decodeHex } from "jsr:@ende/encoding";

function

function decodeHex(src: string): Uint8Array_

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

src: string

The hex-encoded string to decode.

Returns

The decoded data.

Example: Usage

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

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

Source