@ende/encoding/hex
ende add jsr:@ende/encodingVersion 2026.10.15 on JSR.
Port of the Go encoding/hex library.
import {
decodeHex,
encodeHex,
} from "@ende/encoding/hex";
import { assertEquals } from "@ende/assert";
assertEquals(encodeHex("abc"), "616263");
assertEquals(
decodeHex("616263"),
new TextEncoder().encode("abc"),
);
Exports
decodeHex— Decodes the given hex-encoded string. If the input is malformed, an error is thrown.encodeHex— Converts data into a hex-encoded string.Uint8Array_— Proxy type of {@code Uint8Array<ArrayBuffer>} or {@code Uint8Array} in TypeScript 5.7 or below respectively.