TextDecoder
interface
interface TextDecoder extends TextDecoderCommonRepresents a decoder for a specific text encoding, allowing you to convert binary data into a string given the encoding.
Example
const decoder = new TextDecoder('utf-8');
const buffer = new Uint8Array([72, 101, 108, 108, 111]);
const decodedString = decoder.decode(buffer);
console.log(decodedString); // Outputs: "Hello"
variable
var TextDecoder: { … }The constructor object for TextDecoder, used to create a decoder
for a given text encoding (UTF-8 by default) that turns byte streams into
strings.
Constructors
constructor
new TextDecoder(label?: string, options?: TextDecoderOptions): TextDecoderProperties
prototype
readonly prototype: TextDecoderMethods
decode
decode(input?: AllowSharedBufferSource, options?: TextDecodeOptions): stringTurns binary data, often in the form of a Uint8Array, into a string given the encoding.