global.TextDecoder
UTF-8 only; invalid bytes decode as U+FFFD.
Utilização
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);Construtores
(label?: string, options?: { fatal?: false; ignoreBOM?: boolean; }): TextDecoderParâmetros
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
label | string | Não | — |
options | { fatal?: false; ignoreBOM?: boolean;} | Não | — |
Devolve
TextDecoder
Propriedades e métodos 5
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
prototypesó de leitura | TextDecoder | Sim | — |
encodingsó de leitura | "utf-8" | Sim | — |
fatalsó de leitura | false | Sim | — |
ignoreBOMsó de leitura | boolean | Sim | — |
decode | (input?: ArrayBuffer | ArrayBufferView) => string | Sim | — |
decode — assinaturas de método
Assinaturas
(input?: ArrayBuffer | ArrayBufferView): stringParâmetros
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
input | ArrayBuffer | ArrayBufferView<ArrayBufferLike> | Não | — |
Devolve
string
Gerado a partir das declarações TypeScript públicas: assinaturas, props e predefinições vêm da fonte verificada, as descrições da sua JSDoc. Nenhuma predefinição é inventada.