Skip to content

@ralphschuler.parser combinator.unicode.<internal>.TextDecoder

github-actions edited this page Nov 26, 2023 · 1 revision

Class: TextDecoder

unicode.<internal>.TextDecoder

An implementation of the WHATWG Encoding Standard TextDecoder API.

const decoder = new TextDecoder();
const u8arr = new Uint8Array([72, 101, 108, 108, 111]);
console.log(decoder.decode(u8arr)); // Hello

Since

v8.3.0

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new TextDecoder(encoding?, options?): TextDecoder

Parameters

Name Type
encoding? string
options? Object
options.fatal? boolean
options.ignoreBOM? boolean

Returns

TextDecoder

Defined in

node_modules/@types/node/util.d.ts:1201

Properties

encoding

Readonly encoding: string

The encoding supported by the TextDecoder instance.

Defined in

node_modules/@types/node/util.d.ts:1190


fatal

Readonly fatal: boolean

The value will be true if decoding errors result in a TypeError being thrown.

Defined in

node_modules/@types/node/util.d.ts:1195


ignoreBOM

Readonly ignoreBOM: boolean

The value will be true if the decoding result will include the byte order mark.

Defined in

node_modules/@types/node/util.d.ts:1200

Methods

decode

decode(input?, options?): string

Decodes the input and returns a string. If options.stream is true, any incomplete byte sequences occurring at the end of the input are buffered internally and emitted after the next call to textDecoder.decode().

If textDecoder.fatal is true, decoding errors that occur will result in aTypeError being thrown.

Parameters

Name Type Description
input? null | ArrayBuffer | ArrayBufferView An ArrayBuffer, DataView, or TypedArray instance containing the encoded data.
options? Object -
options.stream? boolean -

Returns

string

Defined in

node_modules/@types/node/util.d.ts:1216

Typescript Libraries

Modules

Namespaces

Clone this wiki locally