TextDecoder (class)
The built-in TextDecoder object allows one to read the value into an actual JavaScript string, given the buffer.
Status: unstable
Constructor Parameters
Example usage
const decoder = new TextDecoder();
Extra behaviors
Instance Methods
TextDecoder.decode(octets)
Status: unstable
Returns: string
Parameters
Name | Type | Description |
---|---|---|
octets | number[] | The octets to be decoded into a string |
Example usage
const encoder = new TextEncoder();
const octets = encoder.encode("Hello World");
const decoder = new TextDecoder();
const decoded = decoder.decode(octets);