decodeHex

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

function ยท experimental

function decodeHex(input: string | Uint8Array_): Uint8Array_

decodeHex takes an input source and decodes it into a Uint8Array<ArrayBuffer> using the specified format.

input: string | Uint8Array_

The input source to decode.

Returns

The decoded Uint8Array<ArrayBuffer>.

Example: Basic Usage

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

assertEquals(
  decodeHex("48656c6c6f20576f726c64"),
  new TextEncoder().encode("Hello World"),
);

Source