interface TextDecoder
extends TextDecoderCommon
Represents a decoder for a specific text encoding, allowing you to convert binary data into a string given the encoding.
Examples #
#
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"
Methods #
#decode(input?: BufferSource,options?: TextDecodeOptions,): string
Turns binary data, often in the form of a Uint8Array, into a string given the encoding.
variable TextDecoder
Properties #
readonly
#prototype: TextDecoder