UNPKG

1.2 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}
30
31interface TextEncoder {
32 readonly encoding: string;
33 encode(input?: string, options?: TextEncodeOptions): Uint8Array;
34}
35
36interface TextDecoder {
37 readonly encoding: string;
38 decode(input?: Uint8Array, options?: TextDecoderOptions): string;
39}
40
41declare module "text-encoding" {
42 export = TextEncoding;
43}