(input: Uint8Array | string): stringEncodes 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"encoding
Source effect/Encoding.ts:4172 lines
export const const encodeHex: (
input: Uint8Array | string
) => string
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"
encodeHex: (input: string | Uint8Array<ArrayBufferLike>input: interface Uint8Array<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike>A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the
requested number of bytes could not be allocated an exception is raised.
Uint8Array | string) => string = (input: string | Uint8Array<ArrayBufferLike>input) =>
typeof input: string | Uint8Array<ArrayBufferLike>input === "string" ? const hexEncodeUint8Array: (
bytes: Uint8Array
) => string
hexEncodeUint8Array(const encoder: TextEncoderencoder.TextEncoder.encode(input?: string): Uint8Array<ArrayBuffer>The TextEncoder.encode() method takes a string as input, and returns a Global_Objects/Uint8Array containing the text given in parameters encoded with the specific method for that TextEncoder object.
encode(input: stringinput)) : const hexEncodeUint8Array: (
bytes: Uint8Array
) => string
hexEncodeUint8Array(input: Uint8Array<ArrayBufferLike>input)Referenced by 1 symbols