Skip to content

Function: hexToArrayBuffer() ​

ts
function hexToArrayBuffer(hex): ArrayBuffer;

Defined in: hexToArrayBuffer.ts:12

Decodes a hexadecimal string into an ArrayBuffer.

Parameters ​

hex ​

string

The hexadecimal string to decode.

Returns ​

ArrayBuffer

The decoded ArrayBuffer.

Example ​

ts
const hex = 'a0564af760c2d94b9610c7ae70d5d970'
const result = hexToArrayBuffer(hex)

const expected = new Uint8Array([
	160, 86, 74, 247, 96, 194, 217, 75, 150, 16, 199, 174, 112, 213, 217, 112,
])

deepEqual(new Uint8Array(result), expected)

A Streaming Video Technology Alliance project.