@types/node 10.12.20 → 10.12.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
node/util.d.ts ADDED
@@ -0,0 +1,169 @@
1
+ declare module "util" {
2
+ interface InspectOptions extends NodeJS.InspectOptions { }
3
+ function format(format: any, ...param: any[]): string;
4
+ function formatWithOptions(inspectOptions: InspectOptions, format: string, ...param: any[]): string;
5
+ /** @deprecated since v0.11.3 - use `console.error()` instead. */
6
+ function debug(string: string): void;
7
+ /** @deprecated since v0.11.3 - use `console.error()` instead. */
8
+ function error(...param: any[]): void;
9
+ /** @deprecated since v0.11.3 - use `console.log()` instead. */
10
+ function puts(...param: any[]): void;
11
+ /** @deprecated since v0.11.3 - use `console.log()` instead. */
12
+ function print(...param: any[]): void;
13
+ /** @deprecated since v0.11.3 - use a third party module instead. */
14
+ function log(string: string): void;
15
+ function inspect(object: any, showHidden?: boolean, depth?: number | null, color?: boolean): string;
16
+ function inspect(object: any, options: InspectOptions): string;
17
+ namespace inspect {
18
+ let colors: {
19
+ [color: string]: [number, number] | undefined
20
+ };
21
+ let styles: {
22
+ [style: string]: string | undefined
23
+ };
24
+ let defaultOptions: InspectOptions;
25
+ }
26
+ /** @deprecated since v4.0.0 - use `Array.isArray()` instead. */
27
+ function isArray(object: any): object is any[];
28
+ /** @deprecated since v4.0.0 - use `util.types.isRegExp()` instead. */
29
+ function isRegExp(object: any): object is RegExp;
30
+ /** @deprecated since v4.0.0 - use `util.types.isDate()` instead. */
31
+ function isDate(object: any): object is Date;
32
+ /** @deprecated since v4.0.0 - use `util.types.isNativeError()` instead. */
33
+ function isError(object: any): object is Error;
34
+ function inherits(constructor: any, superConstructor: any): void;
35
+ function debuglog(key: string): (msg: string, ...param: any[]) => void;
36
+ /** @deprecated since v4.0.0 - use `typeof value === 'boolean'` instead. */
37
+ function isBoolean(object: any): object is boolean;
38
+ /** @deprecated since v4.0.0 - use `Buffer.isBuffer()` instead. */
39
+ function isBuffer(object: any): object is Buffer;
40
+ /** @deprecated since v4.0.0 - use `typeof value === 'function'` instead. */
41
+ function isFunction(object: any): boolean;
42
+ /** @deprecated since v4.0.0 - use `value === null` instead. */
43
+ function isNull(object: any): object is null;
44
+ /** @deprecated since v4.0.0 - use `value === null || value === undefined` instead. */
45
+ function isNullOrUndefined(object: any): object is null | undefined;
46
+ /** @deprecated since v4.0.0 - use `typeof value === 'number'` instead. */
47
+ function isNumber(object: any): object is number;
48
+ /** @deprecated since v4.0.0 - use `value !== null && typeof value === 'object'` instead. */
49
+ function isObject(object: any): boolean;
50
+ /** @deprecated since v4.0.0 - use `(typeof value !== 'object' && typeof value !== 'function') || value === null` instead. */
51
+ function isPrimitive(object: any): boolean;
52
+ /** @deprecated since v4.0.0 - use `typeof value === 'string'` instead. */
53
+ function isString(object: any): object is string;
54
+ /** @deprecated since v4.0.0 - use `typeof value === 'symbol'` instead. */
55
+ function isSymbol(object: any): object is symbol;
56
+ /** @deprecated since v4.0.0 - use `value === undefined` instead. */
57
+ function isUndefined(object: any): object is undefined;
58
+ function deprecate<T extends Function>(fn: T, message: string): T;
59
+ function isDeepStrictEqual(val1: any, val2: any): boolean;
60
+
61
+ interface CustomPromisify<TCustom extends Function> extends Function {
62
+ __promisify__: TCustom;
63
+ }
64
+
65
+ function callbackify(fn: () => Promise<void>): (callback: (err: NodeJS.ErrnoException) => void) => void;
66
+ function callbackify<TResult>(fn: () => Promise<TResult>): (callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void;
67
+ function callbackify<T1>(fn: (arg1: T1) => Promise<void>): (arg1: T1, callback: (err: NodeJS.ErrnoException) => void) => void;
68
+ function callbackify<T1, TResult>(fn: (arg1: T1) => Promise<TResult>): (arg1: T1, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void;
69
+ function callbackify<T1, T2>(fn: (arg1: T1, arg2: T2) => Promise<void>): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException) => void) => void;
70
+ function callbackify<T1, T2, TResult>(fn: (arg1: T1, arg2: T2) => Promise<TResult>): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void;
71
+ function callbackify<T1, T2, T3>(fn: (arg1: T1, arg2: T2, arg3: T3) => Promise<void>): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException) => void) => void;
72
+ function callbackify<T1, T2, T3, TResult>(
73
+ fn: (arg1: T1, arg2: T2, arg3: T3) => Promise<TResult>): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void;
74
+ function callbackify<T1, T2, T3, T4>(
75
+ fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<void>): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException) => void) => void;
76
+ function callbackify<T1, T2, T3, T4, TResult>(
77
+ fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<TResult>): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void;
78
+ function callbackify<T1, T2, T3, T4, T5>(
79
+ fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<void>): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException) => void) => void;
80
+ function callbackify<T1, T2, T3, T4, T5, TResult>(
81
+ fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<TResult>,
82
+ ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void;
83
+ function callbackify<T1, T2, T3, T4, T5, T6>(
84
+ fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise<void>,
85
+ ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException) => void) => void;
86
+ function callbackify<T1, T2, T3, T4, T5, T6, TResult>(
87
+ fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise<TResult>
88
+ ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void;
89
+
90
+ function promisify<TCustom extends Function>(fn: CustomPromisify<TCustom>): TCustom;
91
+ function promisify<TResult>(fn: (callback: (err: Error | null, result: TResult) => void) => void): () => Promise<TResult>;
92
+ function promisify(fn: (callback: (err?: Error | null) => void) => void): () => Promise<void>;
93
+ function promisify<T1, TResult>(fn: (arg1: T1, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1) => Promise<TResult>;
94
+ function promisify<T1>(fn: (arg1: T1, callback: (err?: Error | null) => void) => void): (arg1: T1) => Promise<void>;
95
+ function promisify<T1, T2, TResult>(fn: (arg1: T1, arg2: T2, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1, arg2: T2) => Promise<TResult>;
96
+ function promisify<T1, T2>(fn: (arg1: T1, arg2: T2, callback: (err?: Error | null) => void) => void): (arg1: T1, arg2: T2) => Promise<void>;
97
+ function promisify<T1, T2, T3, TResult>(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err: Error | null, result: TResult) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise<TResult>;
98
+ function promisify<T1, T2, T3>(fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err?: Error | null) => void) => void): (arg1: T1, arg2: T2, arg3: T3) => Promise<void>;
99
+ function promisify<T1, T2, T3, T4, TResult>(
100
+ fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: Error | null, result: TResult) => void) => void,
101
+ ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<TResult>;
102
+ function promisify<T1, T2, T3, T4>(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err?: Error | null) => void) => void): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<void>;
103
+ function promisify<T1, T2, T3, T4, T5, TResult>(
104
+ fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: Error | null, result: TResult) => void) => void,
105
+ ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<TResult>;
106
+ function promisify<T1, T2, T3, T4, T5>(
107
+ fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err?: Error | null) => void) => void,
108
+ ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<void>;
109
+ function promisify(fn: Function): Function;
110
+
111
+ namespace types {
112
+ function isAnyArrayBuffer(object: any): boolean;
113
+ function isArgumentsObject(object: any): object is IArguments;
114
+ function isArrayBuffer(object: any): object is ArrayBuffer;
115
+ function isAsyncFunction(object: any): boolean;
116
+ function isBooleanObject(object: any): object is Boolean;
117
+ function isBoxedPrimitive(object: any): object is (Number | Boolean | String | Symbol /* BigInt */);
118
+ function isDataView(object: any): object is DataView;
119
+ function isDate(object: any): object is Date;
120
+ function isExternal(object: any): boolean;
121
+ function isFloat32Array(object: any): object is Float32Array;
122
+ function isFloat64Array(object: any): object is Float64Array;
123
+ function isGeneratorFunction(object: any): boolean;
124
+ function isGeneratorObject(object: any): boolean;
125
+ function isInt8Array(object: any): object is Int8Array;
126
+ function isInt16Array(object: any): object is Int16Array;
127
+ function isInt32Array(object: any): object is Int32Array;
128
+ function isMap(object: any): boolean;
129
+ function isMapIterator(object: any): boolean;
130
+ function isNativeError(object: any): object is Error;
131
+ function isNumberObject(object: any): object is Number;
132
+ function isPromise(object: any): boolean;
133
+ function isProxy(object: any): boolean;
134
+ function isRegExp(object: any): object is RegExp;
135
+ function isSet(object: any): boolean;
136
+ function isSetIterator(object: any): boolean;
137
+ function isSharedArrayBuffer(object: any): boolean;
138
+ function isStringObject(object: any): boolean;
139
+ function isSymbolObject(object: any): boolean;
140
+ function isTypedArray(object: any): object is NodeJS.TypedArray;
141
+ function isUint8Array(object: any): object is Uint8Array;
142
+ function isUint8ClampedArray(object: any): object is Uint8ClampedArray;
143
+ function isUint16Array(object: any): object is Uint16Array;
144
+ function isUint32Array(object: any): object is Uint32Array;
145
+ function isWeakMap(object: any): boolean;
146
+ function isWeakSet(object: any): boolean;
147
+ function isWebAssemblyCompiledModule(object: any): boolean;
148
+ }
149
+
150
+ class TextDecoder {
151
+ readonly encoding: string;
152
+ readonly fatal: boolean;
153
+ readonly ignoreBOM: boolean;
154
+ constructor(
155
+ encoding?: string,
156
+ options?: { fatal?: boolean; ignoreBOM?: boolean }
157
+ );
158
+ decode(
159
+ input?: NodeJS.TypedArray | DataView | ArrayBuffer | null,
160
+ options?: { stream?: boolean }
161
+ ): string;
162
+ }
163
+
164
+ class TextEncoder {
165
+ readonly encoding: string;
166
+ constructor();
167
+ encode(input?: string): Uint8Array;
168
+ }
169
+ }
node/v8.d.ts ADDED
@@ -0,0 +1,28 @@
1
+ declare module "v8" {
2
+ interface HeapSpaceInfo {
3
+ space_name: string;
4
+ space_size: number;
5
+ space_used_size: number;
6
+ space_available_size: number;
7
+ physical_space_size: number;
8
+ }
9
+
10
+ // ** Signifies if the --zap_code_space option is enabled or not. 1 == enabled, 0 == disabled. */
11
+ type DoesZapCodeSpaceFlag = 0 | 1;
12
+
13
+ interface HeapInfo {
14
+ total_heap_size: number;
15
+ total_heap_size_executable: number;
16
+ total_physical_size: number;
17
+ total_available_size: number;
18
+ used_heap_size: number;
19
+ heap_size_limit: number;
20
+ malloced_memory: number;
21
+ peak_malloced_memory: number;
22
+ does_zap_garbage: DoesZapCodeSpaceFlag;
23
+ }
24
+
25
+ function getHeapStatistics(): HeapInfo;
26
+ function getHeapSpaceStatistics(): HeapSpaceInfo[];
27
+ function setFlagsFromString(flags: string): void;
28
+ }
node/vm.d.ts ADDED
@@ -0,0 +1,64 @@
1
+ declare module "vm" {
2
+ interface Context {
3
+ [key: string]: any;
4
+ }
5
+ interface BaseOptions {
6
+ /**
7
+ * Specifies the filename used in stack traces produced by this script.
8
+ * Default: `''`.
9
+ */
10
+ filename?: string;
11
+ /**
12
+ * Specifies the line number offset that is displayed in stack traces produced by this script.
13
+ * Default: `0`.
14
+ */
15
+ lineOffset?: number;
16
+ /**
17
+ * Specifies the column number offset that is displayed in stack traces produced by this script.
18
+ * Default: `0`
19
+ */
20
+ columnOffset?: number;
21
+ }
22
+ interface ScriptOptions extends BaseOptions {
23
+ displayErrors?: boolean;
24
+ timeout?: number;
25
+ cachedData?: Buffer;
26
+ produceCachedData?: boolean;
27
+ }
28
+ interface RunningScriptOptions extends BaseOptions {
29
+ displayErrors?: boolean;
30
+ timeout?: number;
31
+ }
32
+ interface CompileFunctionOptions extends BaseOptions {
33
+ /**
34
+ * Provides an optional data with V8's code cache data for the supplied source.
35
+ */
36
+ cachedData?: Buffer;
37
+ /**
38
+ * Specifies whether to produce new cache data.
39
+ * Default: `false`,
40
+ */
41
+ produceCachedData?: boolean;
42
+ /**
43
+ * The sandbox/context in which the said function should be compiled in.
44
+ */
45
+ parsingContext?: Context;
46
+
47
+ /**
48
+ * An array containing a collection of context extensions (objects wrapping the current scope) to be applied while compiling
49
+ */
50
+ contextExtensions?: Object[];
51
+ }
52
+ class Script {
53
+ constructor(code: string, options?: ScriptOptions);
54
+ runInContext(contextifiedSandbox: Context, options?: RunningScriptOptions): any;
55
+ runInNewContext(sandbox?: Context, options?: RunningScriptOptions): any;
56
+ runInThisContext(options?: RunningScriptOptions): any;
57
+ }
58
+ function createContext(sandbox?: Context): Context;
59
+ function isContext(sandbox: Context): boolean;
60
+ function runInContext(code: string, contextifiedSandbox: Context, options?: RunningScriptOptions | string): any;
61
+ function runInNewContext(code: string, sandbox?: Context, options?: RunningScriptOptions | string): any;
62
+ function runInThisContext(code: string, options?: RunningScriptOptions | string): any;
63
+ function compileFunction(code: string, params: string[], options: CompileFunctionOptions): Function;
64
+ }
@@ -0,0 +1,124 @@
1
+ declare module "worker_threads" {
2
+ import { EventEmitter } from "events";
3
+ import { Readable, Writable } from "stream";
4
+
5
+ const isMainThread: boolean;
6
+ const parentPort: null | MessagePort;
7
+ const threadId: number;
8
+ const workerData: any;
9
+
10
+ class MessageChannel {
11
+ readonly port1: MessagePort;
12
+ readonly port2: MessagePort;
13
+ }
14
+
15
+ class MessagePort extends EventEmitter {
16
+ close(): void;
17
+ postMessage(value: any, transferList?: Array<ArrayBuffer | MessagePort>): void;
18
+ ref(): void;
19
+ unref(): void;
20
+ start(): void;
21
+
22
+ addListener(event: "close", listener: () => void): this;
23
+ addListener(event: "message", listener: (value: any) => void): this;
24
+ addListener(event: string | symbol, listener: (...args: any[]) => void): this;
25
+
26
+ emit(event: "close"): boolean;
27
+ emit(event: "message", value: any): boolean;
28
+ emit(event: string | symbol, ...args: any[]): boolean;
29
+
30
+ on(event: "close", listener: () => void): this;
31
+ on(event: "message", listener: (value: any) => void): this;
32
+ on(event: string | symbol, listener: (...args: any[]) => void): this;
33
+
34
+ once(event: "close", listener: () => void): this;
35
+ once(event: "message", listener: (value: any) => void): this;
36
+ once(event: string | symbol, listener: (...args: any[]) => void): this;
37
+
38
+ prependListener(event: "close", listener: () => void): this;
39
+ prependListener(event: "message", listener: (value: any) => void): this;
40
+ prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
41
+
42
+ prependOnceListener(event: "close", listener: () => void): this;
43
+ prependOnceListener(event: "message", listener: (value: any) => void): this;
44
+ prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
45
+
46
+ removeListener(event: "close", listener: () => void): this;
47
+ removeListener(event: "message", listener: (value: any) => void): this;
48
+ removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
49
+
50
+ off(event: "close", listener: () => void): this;
51
+ off(event: "message", listener: (value: any) => void): this;
52
+ off(event: string | symbol, listener: (...args: any[]) => void): this;
53
+ }
54
+
55
+ interface WorkerOptions {
56
+ eval?: boolean;
57
+ workerData?: any;
58
+ stdin?: boolean;
59
+ stdout?: boolean;
60
+ stderr?: boolean;
61
+ }
62
+
63
+ class Worker extends EventEmitter {
64
+ readonly stdin: Writable | null;
65
+ readonly stdout: Readable;
66
+ readonly stderr: Readable;
67
+ readonly threadId: number;
68
+
69
+ constructor(filename: string, options?: WorkerOptions);
70
+
71
+ postMessage(value: any, transferList?: Array<ArrayBuffer | MessagePort>): void;
72
+ ref(): void;
73
+ unref(): void;
74
+ terminate(callback?: (err: any, exitCode: number) => void): void;
75
+
76
+ addListener(event: "error", listener: (err: any) => void): this;
77
+ addListener(event: "exit", listener: (exitCode: number) => void): this;
78
+ addListener(event: "message", listener: (value: any) => void): this;
79
+ addListener(event: "online", listener: () => void): this;
80
+ addListener(event: string | symbol, listener: (...args: any[]) => void): this;
81
+
82
+ emit(event: "error", err: any): boolean;
83
+ emit(event: "exit", exitCode: number): boolean;
84
+ emit(event: "message", value: any): boolean;
85
+ emit(event: "online"): boolean;
86
+ emit(event: string | symbol, ...args: any[]): boolean;
87
+
88
+ on(event: "error", listener: (err: any) => void): this;
89
+ on(event: "exit", listener: (exitCode: number) => void): this;
90
+ on(event: "message", listener: (value: any) => void): this;
91
+ on(event: "online", listener: () => void): this;
92
+ on(event: string | symbol, listener: (...args: any[]) => void): this;
93
+
94
+ once(event: "error", listener: (err: any) => void): this;
95
+ once(event: "exit", listener: (exitCode: number) => void): this;
96
+ once(event: "message", listener: (value: any) => void): this;
97
+ once(event: "online", listener: () => void): this;
98
+ once(event: string | symbol, listener: (...args: any[]) => void): this;
99
+
100
+ prependListener(event: "error", listener: (err: any) => void): this;
101
+ prependListener(event: "exit", listener: (exitCode: number) => void): this;
102
+ prependListener(event: "message", listener: (value: any) => void): this;
103
+ prependListener(event: "online", listener: () => void): this;
104
+ prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
105
+
106
+ prependOnceListener(event: "error", listener: (err: any) => void): this;
107
+ prependOnceListener(event: "exit", listener: (exitCode: number) => void): this;
108
+ prependOnceListener(event: "message", listener: (value: any) => void): this;
109
+ prependOnceListener(event: "online", listener: () => void): this;
110
+ prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
111
+
112
+ removeListener(event: "error", listener: (err: any) => void): this;
113
+ removeListener(event: "exit", listener: (exitCode: number) => void): this;
114
+ removeListener(event: "message", listener: (value: any) => void): this;
115
+ removeListener(event: "online", listener: () => void): this;
116
+ removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
117
+
118
+ off(event: "error", listener: (err: any) => void): this;
119
+ off(event: "exit", listener: (exitCode: number) => void): this;
120
+ off(event: "message", listener: (value: any) => void): this;
121
+ off(event: "online", listener: () => void): this;
122
+ off(event: string | symbol, listener: (...args: any[]) => void): this;
123
+ }
124
+ }
node/zlib.d.ts ADDED
@@ -0,0 +1,141 @@
1
+ declare module "zlib" {
2
+ import * as stream from "stream";
3
+
4
+ interface ZlibOptions {
5
+ flush?: number; // default: zlib.constants.Z_NO_FLUSH
6
+ finishFlush?: number; // default: zlib.constants.Z_FINISH
7
+ chunkSize?: number; // default: 16*1024
8
+ windowBits?: number;
9
+ level?: number; // compression only
10
+ memLevel?: number; // compression only
11
+ strategy?: number; // compression only
12
+ dictionary?: Buffer | NodeJS.TypedArray | DataView | ArrayBuffer; // deflate/inflate only, empty dictionary by default
13
+ }
14
+
15
+ interface Zlib {
16
+ /** @deprecated Use bytesWritten instead. */
17
+ readonly bytesRead: number;
18
+ readonly bytesWritten: number;
19
+ shell?: boolean | string;
20
+ close(callback?: () => void): void;
21
+ flush(kind?: number | (() => void), callback?: () => void): void;
22
+ }
23
+
24
+ interface ZlibParams {
25
+ params(level: number, strategy: number, callback: () => void): void;
26
+ }
27
+
28
+ interface ZlibReset {
29
+ reset(): void;
30
+ }
31
+
32
+ interface Gzip extends stream.Transform, Zlib { }
33
+ interface Gunzip extends stream.Transform, Zlib { }
34
+ interface Deflate extends stream.Transform, Zlib, ZlibReset, ZlibParams { }
35
+ interface Inflate extends stream.Transform, Zlib, ZlibReset { }
36
+ interface DeflateRaw extends stream.Transform, Zlib, ZlibReset, ZlibParams { }
37
+ interface InflateRaw extends stream.Transform, Zlib, ZlibReset { }
38
+ interface Unzip extends stream.Transform, Zlib { }
39
+
40
+ function createGzip(options?: ZlibOptions): Gzip;
41
+ function createGunzip(options?: ZlibOptions): Gunzip;
42
+ function createDeflate(options?: ZlibOptions): Deflate;
43
+ function createInflate(options?: ZlibOptions): Inflate;
44
+ function createDeflateRaw(options?: ZlibOptions): DeflateRaw;
45
+ function createInflateRaw(options?: ZlibOptions): InflateRaw;
46
+ function createUnzip(options?: ZlibOptions): Unzip;
47
+
48
+ type InputType = string | Buffer | DataView | ArrayBuffer | NodeJS.TypedArray;
49
+ function deflate(buf: InputType, callback: (error: Error | null, result: Buffer) => void): void;
50
+ function deflate(buf: InputType, options: ZlibOptions, callback: (error: Error | null, result: Buffer) => void): void;
51
+ function deflateSync(buf: InputType, options?: ZlibOptions): Buffer;
52
+ function deflateRaw(buf: InputType, callback: (error: Error | null, result: Buffer) => void): void;
53
+ function deflateRaw(buf: InputType, options: ZlibOptions, callback: (error: Error | null, result: Buffer) => void): void;
54
+ function deflateRawSync(buf: InputType, options?: ZlibOptions): Buffer;
55
+ function gzip(buf: InputType, callback: (error: Error | null, result: Buffer) => void): void;
56
+ function gzip(buf: InputType, options: ZlibOptions, callback: (error: Error | null, result: Buffer) => void): void;
57
+ function gzipSync(buf: InputType, options?: ZlibOptions): Buffer;
58
+ function gunzip(buf: InputType, callback: (error: Error | null, result: Buffer) => void): void;
59
+ function gunzip(buf: InputType, options: ZlibOptions, callback: (error: Error | null, result: Buffer) => void): void;
60
+ function gunzipSync(buf: InputType, options?: ZlibOptions): Buffer;
61
+ function inflate(buf: InputType, callback: (error: Error | null, result: Buffer) => void): void;
62
+ function inflate(buf: InputType, options: ZlibOptions, callback: (error: Error | null, result: Buffer) => void): void;
63
+ function inflateSync(buf: InputType, options?: ZlibOptions): Buffer;
64
+ function inflateRaw(buf: InputType, callback: (error: Error | null, result: Buffer) => void): void;
65
+ function inflateRaw(buf: InputType, options: ZlibOptions, callback: (error: Error | null, result: Buffer) => void): void;
66
+ function inflateRawSync(buf: InputType, options?: ZlibOptions): Buffer;
67
+ function unzip(buf: InputType, callback: (error: Error | null, result: Buffer) => void): void;
68
+ function unzip(buf: InputType, options: ZlibOptions, callback: (error: Error | null, result: Buffer) => void): void;
69
+ function unzipSync(buf: InputType, options?: ZlibOptions): Buffer;
70
+
71
+ namespace constants {
72
+ // Allowed flush values.
73
+
74
+ const Z_NO_FLUSH: number;
75
+ const Z_PARTIAL_FLUSH: number;
76
+ const Z_SYNC_FLUSH: number;
77
+ const Z_FULL_FLUSH: number;
78
+ const Z_FINISH: number;
79
+ const Z_BLOCK: number;
80
+ const Z_TREES: number;
81
+
82
+ // Return codes for the compression/decompression functions. Negative values are errors, positive values are used for special but normal events.
83
+
84
+ const Z_OK: number;
85
+ const Z_STREAM_END: number;
86
+ const Z_NEED_DICT: number;
87
+ const Z_ERRNO: number;
88
+ const Z_STREAM_ERROR: number;
89
+ const Z_DATA_ERROR: number;
90
+ const Z_MEM_ERROR: number;
91
+ const Z_BUF_ERROR: number;
92
+ const Z_VERSION_ERROR: number;
93
+
94
+ // Compression levels.
95
+
96
+ const Z_NO_COMPRESSION: number;
97
+ const Z_BEST_SPEED: number;
98
+ const Z_BEST_COMPRESSION: number;
99
+ const Z_DEFAULT_COMPRESSION: number;
100
+
101
+ // Compression strategy.
102
+
103
+ const Z_FILTERED: number;
104
+ const Z_HUFFMAN_ONLY: number;
105
+ const Z_RLE: number;
106
+ const Z_FIXED: number;
107
+ const Z_DEFAULT_STRATEGY: number;
108
+ }
109
+
110
+ // Constants
111
+ const Z_NO_FLUSH: number;
112
+ const Z_PARTIAL_FLUSH: number;
113
+ const Z_SYNC_FLUSH: number;
114
+ const Z_FULL_FLUSH: number;
115
+ const Z_FINISH: number;
116
+ const Z_BLOCK: number;
117
+ const Z_TREES: number;
118
+ const Z_OK: number;
119
+ const Z_STREAM_END: number;
120
+ const Z_NEED_DICT: number;
121
+ const Z_ERRNO: number;
122
+ const Z_STREAM_ERROR: number;
123
+ const Z_DATA_ERROR: number;
124
+ const Z_MEM_ERROR: number;
125
+ const Z_BUF_ERROR: number;
126
+ const Z_VERSION_ERROR: number;
127
+ const Z_NO_COMPRESSION: number;
128
+ const Z_BEST_SPEED: number;
129
+ const Z_BEST_COMPRESSION: number;
130
+ const Z_DEFAULT_COMPRESSION: number;
131
+ const Z_FILTERED: number;
132
+ const Z_HUFFMAN_ONLY: number;
133
+ const Z_RLE: number;
134
+ const Z_FIXED: number;
135
+ const Z_DEFAULT_STRATEGY: number;
136
+ const Z_BINARY: number;
137
+ const Z_TEXT: number;
138
+ const Z_ASCII: number;
139
+ const Z_UNKNOWN: number;
140
+ const Z_DEFLATED: number;
141
+ }