Skip to content

decodeText

decodeText(bytes, encoding, options?): string

Defined in: packages/core/src/buffer/text/decode-text.ts:78

Decode bytes as text. Copies, so the result does not alias the input.

Uint8Array

Source bytes.

TextDecodingName

Text encoding.

DecodeTextOptions

See DecodeTextOptions.

string

The decoded string.

When options.fatal is true and bytes is not valid for encoding. Never thrown for "latin1", "ascii" and "windows-1252", for which every byte is valid.

For "shift_jis" where the runtime’s TextDecoder lacks it.

isValidText to test validity without decoding into a string the caller does not need.