Skip to content

hexEncode ​

Encodes an ArrayBuffer or Uint8Array into a hexadecimal string.

Syntax ​

typescript
hexEncode(data: ArrayBuffer | Uint8Array): string

Parameters ​

NameTypeDescription
dataArrayBuffer | Uint8ArrayThe data to be encoded

Returns ​

TypeDescription
stringThe resulting hexadecimal string

Example ​

typescript
hexEncode(new Uint8Array([72, 101, 108, 108, 111])); // "48656c6c6f"

Notes ​

  • Converts each byte to its hexadecimal representation.

References ​

Released under the MIT License.