UNPKG

1.3 kBTypeScriptView Raw
1declare namespace TextEncoding {
2 interface TextEncoderOptions {
3 NONSTANDARD_allowLegacyEncoding?: boolean | undefined;
4 }
5 interface TextEncoderStatic {
6 (utfLabel?: string, options?: TextEncoderOptions): TextEncoder;
7 new(utfLabel?: string, options?: TextEncoderOptions): TextEncoder;
8 }
9
10 export var TextEncoder: {
11 new(utfLabel?: string, options?: TextEncoderOptions): TextEncoder;
12 (utfLabel?: string, options?: TextEncoderOptions): TextEncoder;
13 encoding: string;
14 };
15
16 export var TextDecoder: {
17 (label?: string, options?: TextDecoderOptions): TextDecoder;
18 new(label?: string, options?: TextDecoderOptions): TextDecoder;
19 encoding: string;
20 };
21}
22
23interface TextEncodeOptions {
24 stream?: boolean | undefined;
25}
26
27interface TextDecoderOptions {
28 stream?: boolean | undefined;
29 fatal?: boolean;
30 ignoreBOM?: boolean;
31}
32
33interface TextEncoder {
34 readonly encoding: string;
35 encode(input?: string, options?: TextEncodeOptions): Uint8Array;
36}
37
38interface TextDecoder {
39 readonly encoding: string;
40 readonly fatal: boolean;
41 readonly ignoreBOM: boolean;
42 decode(input?: Uint8Array, options?: TextDecoderOptions): string;
43}
44
45declare module "text-encoding" {
46 export = TextEncoding;
47}