nx.js
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.

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

ParameterType
encoding?string

Returns

TextDecoder

Properties

PropertyTypeDescription
encodingstringReturns encoding's name, lowercased. MDN Reference
fatalbooleanReturns true if error mode is "fatal", otherwise false. MDN Reference
ignoreBOMbooleanReturns 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

ParameterTypeDescription
input?BufferSourceThe BufferSource to decode.
options?TextDecodeOptionsThe options for decoding.

Returns

string

The decoded string.

Implementation of

globalThis.TextDecoder.decode

On this page