-
-
Notifications
You must be signed in to change notification settings - Fork 46
Expand file tree
/
Copy pathtextdecoder.d.ts
More file actions
61 lines (54 loc) · 1.86 KB
/
textdecoder.d.ts
File metadata and controls
61 lines (54 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Adapted from file://./node_modules/typescript/lib/lib.dom.d.ts so we don't have to include the entire DOM lib
// Ref: https://github.com/microsoft/TypeScript/issues/31535, https://github.com/microsoft/TypeScript/issues/41727, https://github.com/microsoft/TypeScript-DOM-lib-generator/issues/1685
type AllowSharedBufferSource =
| ArrayBufferLike
| ArrayBufferView<ArrayBufferLike>;
interface TextDecodeOptions {
stream?: boolean;
}
interface TextDecoderOptions {
fatal?: boolean;
ignoreBOM?: boolean;
}
/**
* The **`TextDecoder`** interface represents a decoder for a specific text encoding, such as `UTF-8`, `ISO-8859-2`, `KOI8-R`, `GBK`, etc.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder)
*/
interface TextDecoder extends TextDecoderCommon {
/**
* The **`TextDecoder.decode()`** method returns a string containing text decoded from the buffer passed as a parameter.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder/decode)
*/
decode(input?: AllowSharedBufferSource, options?: TextDecodeOptions): string;
}
// eslint-disable-next-line no-var
declare var TextDecoder: {
prototype: TextDecoder;
new (label?: string, options?: TextDecoderOptions): TextDecoder;
};
interface TextDecoderCommon {
/**
* Returns encoding's name, lowercased.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder/encoding)
*/
readonly encoding: string;
/**
* Returns true if error mode is "fatal", otherwise false.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder/fatal)
*/
readonly fatal: boolean;
/**
* Returns the value of ignore BOM.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder/ignoreBOM)
*/
readonly ignoreBOM: boolean;
}
// eslint-disable-next-line no-var
declare var module: {
exports: unknown;
};