Function: decodeText()
ts
function decodeText(data, options?): string;Defined in: decodeText.ts:21
Converts an ArrayBuffer or ArrayBufferView to a string. The function works like TextDecoder.decode and also supports environments without TextDecoder.
Parameters
data
| ArrayBufferLike | ArrayBufferView<ArrayBufferLike>
The data to decode.
options?
DecodeTextOptions = {}
The options for the decoding.
Returns
string
The string representation of the ArrayBuffer.
Example
ts
const str = 'hello world'
const utf8 = new Uint8Array(strToCodes(str))
equal(decodeText(utf8.buffer, { encoding: UTF_8 }), str)