Classes
TextDecoder
The TextDecoder
interface represents a decoder for a specific text encoding.
The implementation in nx.js only supports "utf-8"
decoding.
If you need to decode binary data of a different encoding, consider importing
a more full-featured polyfill, such as @kayahr/text-encoding
.
Copyright
Apache License 2.0
Author
Sam Thorogood
See
https://github.com/samthor/fast-text-encoding/blob/master/src/lowlevel.js
Implements
Constructors
new TextDecoder()
new TextDecoder(encoding
?): TextDecoder
Parameters
Parameter | Type |
---|---|
encoding ? | string |
Returns
Properties
Property | Type | Description |
---|---|---|
encoding | string | Returns encoding's name, lowercased. MDN Reference |
fatal | boolean | Returns true if error mode is "fatal", otherwise false. MDN Reference |
ignoreBOM | boolean | Returns the value of ignore BOM. MDN Reference |
Methods
decode()
decode(input
?, options
?): string
Decodes a BufferSource into a string using the specified encoding. If no input is provided, an empty string is returned.
Note: Currently the stream
option is not supported.
Parameters
Parameter | Type | Description |
---|---|---|
input ? | BufferSource | The BufferSource to decode. |
options ? | TextDecodeOptions | The options for decoding. |
Returns
string
The decoded string.
Implementation of
globalThis.TextDecoder.decode