effect-io-ai

Package: effect
Module: Encoding

Encoding.encodeHex

Encodes the given value into a hex string.

When to use

Use to encode text or bytes as lowercase hexadecimal text.

Example (Encoding hex strings and bytes)

import { Encoding } from "effect"

// Encode a string to hex
console.log(Encoding.encodeHex("hello")) // "68656c6c6f"

// Encode binary data to hex
const bytes = new Uint8Array([72, 101, 108, 108, 111])
console.log(Encoding.encodeHex(bytes)) // "48656c6c6f"

Signature

declare const encodeHex: (input: Uint8Array | string) => string

Source

Since v2.0.0