global.TextDecoder
UTF-8 only; invalid bytes decode as U+FFFD.
Usage
Decode a UTF-8 file returned as bytes.
// Decode a UTF-8 file returned as bytes.
import { fileSystem } from 'kuito';
const bytes = await fileSystem.readBytes(fileSystem.documents + 'notes.txt');
const text = new TextDecoder().decode(bytes);
console.log(text);Constructors
(label?: string, options?: { fatal?: false; ignoreBOM?: boolean; }): TextDecoderParameters
| Name | Type | Required | Description |
|---|---|---|---|
label | string | No | — |
options | { fatal?: false; ignoreBOM?: boolean;} | No | — |
Returns
TextDecoder
Properties and methods 5
| Name | Type | Required | Description |
|---|---|---|---|
prototypereadonly | TextDecoder | Yes | — |
encodingreadonly | "utf-8" | Yes | — |
fatalreadonly | false | Yes | — |
ignoreBOMreadonly | boolean | Yes | — |
decode | (input?: ArrayBuffer | ArrayBufferView) => string | Yes | — |
decode — method signatures
Signatures
(input?: ArrayBuffer | ArrayBufferView): stringParameters
| Name | Type | Required | Description |
|---|---|---|---|
input | ArrayBuffer | ArrayBufferView<ArrayBufferLike> | No | — |
Returns
string
Generated from the public TypeScript declarations: signatures, props and defaults come from the checked source, descriptions from its JSDoc. No defaults are invented.