@types/node 12.12.69 → 12.19.2

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.
Files changed (53) hide show
  1. {node v12.12 → node v12.19}/LICENSE +0 -0
  2. {node v12.12 → node v12.19}/README.md +1 -1
  3. {node v12.12 → node v12.19}/assert.d.ts +18 -0
  4. {node v12.12 → node v12.19}/async_hooks.d.ts +13 -14
  5. {node v12.12 → node v12.19}/base.d.ts +0 -0
  6. {node v12.12 → node v12.19}/buffer.d.ts +0 -0
  7. {node v12.12 → node v12.19}/child_process.d.ts +0 -0
  8. {node v12.12 → node v12.19}/cluster.d.ts +0 -0
  9. {node v12.12 → node v12.19}/console.d.ts +0 -0
  10. {node v12.12 → node v12.19}/constants.d.ts +0 -0
  11. {node v12.12 → node v12.19}/crypto.d.ts +5 -0
  12. {node v12.12 → node v12.19}/dgram.d.ts +0 -0
  13. {node v12.12 → node v12.19}/dns.d.ts +0 -0
  14. {node v12.12 → node v12.19}/domain.d.ts +0 -0
  15. {node v12.12 → node v12.19}/events.d.ts +0 -0
  16. {node v12.12 → node v12.19}/fs.d.ts +43 -0
  17. {node v12.12 → node v12.19}/globals.d.ts +11 -2
  18. {node v12.12 → node v12.19}/globals.global.d.ts +0 -0
  19. {node v12.12 → node v12.19}/http.d.ts +8 -1
  20. {node v12.12 → node v12.19}/http2.d.ts +0 -0
  21. {node v12.12 → node v12.19}/https.d.ts +0 -0
  22. {node v12.12 → node v12.19}/index.d.ts +1 -1
  23. {node v12.12 → node v12.19}/inspector.d.ts +0 -0
  24. {node v12.12 → node v12.19}/module.d.ts +0 -0
  25. {node v12.12 → node v12.19}/net.d.ts +0 -0
  26. {node v12.12 → node v12.19}/os.d.ts +0 -0
  27. {node v12.12 → node v12.19}/package.json +2 -2
  28. {node v12.12 → node v12.19}/path.d.ts +0 -0
  29. {node v12.12 → node v12.19}/perf_hooks.d.ts +21 -0
  30. {node v12.12 → node v12.19}/process.d.ts +0 -0
  31. {node v12.12 → node v12.19}/punycode.d.ts +0 -0
  32. {node v12.12 → node v12.19}/querystring.d.ts +0 -0
  33. {node v12.12 → node v12.19}/readline.d.ts +0 -0
  34. {node v12.12 → node v12.19}/repl.d.ts +10 -2
  35. {node v12.12 → node v12.19}/stream.d.ts +0 -0
  36. {node v12.12 → node v12.19}/string_decoder.d.ts +0 -0
  37. {node v12.12 → node v12.19}/timers.d.ts +0 -0
  38. {node v12.12 → node v12.19}/tls.d.ts +12 -1
  39. {node v12.12 → node v12.19}/trace_events.d.ts +0 -0
  40. {node v12.12 → node v12.19}/ts3.3/assert.d.ts +0 -0
  41. {node v12.12 → node v12.19}/ts3.3/base.d.ts +0 -0
  42. {node v12.12 → node v12.19}/ts3.3/globals.global.d.ts +0 -0
  43. {node v12.12 → node v12.19}/ts3.3/index.d.ts +0 -0
  44. {node v12.12 → node v12.19}/ts3.6/base.d.ts +0 -0
  45. {node v12.12 → node v12.19}/ts3.6/index.d.ts +0 -0
  46. {node v12.12 → node v12.19}/tty.d.ts +0 -0
  47. {node v12.12 → node v12.19}/url.d.ts +0 -0
  48. {node v12.12 → node v12.19}/util.d.ts +0 -0
  49. {node v12.12 → node v12.19}/v8.d.ts +0 -0
  50. {node v12.12 → node v12.19}/vm.d.ts +0 -0
  51. {node v12.12 → node v12.19}/wasi.d.ts +0 -0
  52. {node v12.12 → node v12.19}/worker_threads.d.ts +29 -1
  53. {node v12.12 → node v12.19}/zlib.d.ts +121 -155
File without changes
@@ -8,7 +8,7 @@ This package contains type definitions for Node.js (http://nodejs.org/).
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node/v12.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Tue, 20 Oct 2020 12:09:03 GMT
11
+ * Last updated: Mon, 26 Oct 2020 22:58:17 GMT
12
12
  * Dependencies: none
13
13
  * Global values: `Buffer`, `NodeJS`, `__dirname`, `__filename`, `clearImmediate`, `clearInterval`, `clearTimeout`, `console`, `exports`, `global`, `module`, `process`, `queueMicrotask`, `require`, `setImmediate`, `setInterval`, `setTimeout`
14
14
 
@@ -19,6 +19,24 @@ declare module 'assert' {
19
19
  });
20
20
  }
21
21
 
22
+ class CallTracker {
23
+ calls(exact?: number): () => void;
24
+ calls<Func extends (...args: any[]) => any>(fn?: Func, exact?: number): Func;
25
+ report(): CallTrackerReportInformation[];
26
+ verify(): void;
27
+ }
28
+ interface CallTrackerReportInformation {
29
+ message: string;
30
+ /** The actual number of times the function was called. */
31
+ actual: number;
32
+ /** The number of times the function was expected to be called. */
33
+ expected: number;
34
+ /** The name of the function that is wrapped. */
35
+ operator: string;
36
+ /** A stack trace of the function. */
37
+ stack: object;
38
+ }
39
+
22
40
  function fail(message?: string | Error): never;
23
41
  /** @deprecated since v10.0.0 - use fail([message]) or other assert functions instead. */
24
42
  function fail(
@@ -115,6 +115,19 @@ declare module "async_hooks" {
115
115
  */
116
116
  constructor(type: string, triggerAsyncId?: number|AsyncResourceOptions);
117
117
 
118
+ /**
119
+ * Binds the given function to the current execution context.
120
+ * @param fn The function to bind to the current execution context.
121
+ * @param type An optional name to associate with the underlying `AsyncResource`.
122
+ */
123
+ static bind<Func extends (...args: any[]) => any>(fn: Func, type?: string): Func & { asyncResource: AsyncResource };
124
+
125
+ /**
126
+ * Binds the given function to execute to this `AsyncResource`'s scope.
127
+ * @param fn The function to bind to the current `AsyncResource`.
128
+ */
129
+ bind<Func extends (...args: any[]) => any>(fn: Func): Func & { asyncResource: AsyncResource };
130
+
118
131
  /**
119
132
  * Call the provided function with the provided arguments in the
120
133
  * execution context of the async resource. This will establish the
@@ -209,20 +222,6 @@ declare module "async_hooks" {
209
222
  */
210
223
  exit(callback: (...args: any[]) => void, ...args: any[]): void;
211
224
 
212
- /**
213
- * This methods runs a function synchronously within a context and return its
214
- * return value. The store is not accessible outside of the callback function or
215
- * the asynchronous operations created within the callback.
216
- *
217
- * Optionally, arguments can be passed to the function. They will be passed to
218
- * the callback function.
219
- *
220
- * If the callback function throws an error, it will be thrown by
221
- * `runSyncAndReturn` too. The stacktrace will not be impacted by this call and
222
- * the context will be exited.
223
- */
224
- runSyncAndReturn<R>(store: T, callback: (...args: any[]) => R, ...args: any[]): R;
225
-
226
225
  /**
227
226
  * This methods runs a function synchronously outside of a context and return its
228
227
  * return value. The store is not accessible within the callback function or
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -368,6 +368,11 @@ declare module "crypto" {
368
368
  function pseudoRandomBytes(size: number): Buffer;
369
369
  function pseudoRandomBytes(size: number, callback: (err: Error | null, buf: Buffer) => void): void;
370
370
 
371
+ function randomInt(max: number): number;
372
+ function randomInt(min: number, max: number): number;
373
+ function randomInt(max: number, callback: (err: Error | null, value: number) => void): void;
374
+ function randomInt(min: number, max: number, callback: (err: Error | null, value: number) => void): void;
375
+
371
376
  function randomFillSync<T extends NodeJS.ArrayBufferView>(buffer: T, offset?: number, size?: number): T;
372
377
  function randomFill<T extends NodeJS.ArrayBufferView>(buffer: T, callback: (err: Error | null, buf: T) => void): void;
373
378
  function randomFill<T extends NodeJS.ArrayBufferView>(buffer: T, offset: number, callback: (err: Error | null, buf: T) => void): void;
File without changes
File without changes
File without changes
File without changes
@@ -346,6 +346,39 @@ declare module "fs" {
346
346
  */
347
347
  function lchownSync(path: PathLike, uid: number, gid: number): void;
348
348
 
349
+ /**
350
+ * Changes the access and modification times of a file in the same way as `fs.utimes()`,
351
+ * with the difference that if the path refers to a symbolic link, then the link is not
352
+ * dereferenced: instead, the timestamps of the symbolic link itself are changed.
353
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
354
+ * @param atime The last access time. If a string is provided, it will be coerced to number.
355
+ * @param mtime The last modified time. If a string is provided, it will be coerced to number.
356
+ */
357
+ function lutimes(path: PathLike, atime: string | number | Date, mtime: string | number | Date, callback: NoParamCallback): void;
358
+
359
+ // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
360
+ namespace lutimes {
361
+ /**
362
+ * Changes the access and modification times of a file in the same way as `fsPromises.utimes()`,
363
+ * with the difference that if the path refers to a symbolic link, then the link is not
364
+ * dereferenced: instead, the timestamps of the symbolic link itself are changed.
365
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
366
+ * @param atime The last access time. If a string is provided, it will be coerced to number.
367
+ * @param mtime The last modified time. If a string is provided, it will be coerced to number.
368
+ */
369
+ function __promisify__(path: PathLike, atime: string | number | Date, mtime: string | number | Date): Promise<void>;
370
+ }
371
+
372
+ /**
373
+ * Change the file system timestamps of the symbolic link referenced by `path`. Returns `undefined`,
374
+ * or throws an exception when parameters are incorrect or the operation fails.
375
+ * This is the synchronous version of `fs.lutimes()`.
376
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
377
+ * @param atime The last access time. If a string is provided, it will be coerced to number.
378
+ * @param mtime The last modified time. If a string is provided, it will be coerced to number.
379
+ */
380
+ function lutimesSync(path: PathLike, atime: string | number | Date, mtime: string | number | Date): void;
381
+
349
382
  /**
350
383
  * Asynchronous chmod(2) - Change permissions of a file.
351
384
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -2324,6 +2357,16 @@ declare module "fs" {
2324
2357
  */
2325
2358
  function lchown(path: PathLike, uid: number, gid: number): Promise<void>;
2326
2359
 
2360
+ /**
2361
+ * Changes the access and modification times of a file in the same way as `fsPromises.utimes()`,
2362
+ * with the difference that if the path refers to a symbolic link, then the link is not
2363
+ * dereferenced: instead, the timestamps of the symbolic link itself are changed.
2364
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2365
+ * @param atime The last access time. If a string is provided, it will be coerced to number.
2366
+ * @param mtime The last modified time. If a string is provided, it will be coerced to number.
2367
+ */
2368
+ function lutimes(path: PathLike, atime: string | number | Date, mtime: string | number | Date): Promise<void>;
2369
+
2327
2370
  /**
2328
2371
  * Asynchronous fchown(2) - Change ownership of a file.
2329
2372
  * @param handle A `FileHandle`.
@@ -934,10 +934,16 @@ declare namespace NodeJS {
934
934
  tls_ocsp: boolean;
935
935
  tls: boolean;
936
936
  };
937
+ /**
938
+ * @deprecated since v12.19.0 - Calling process.umask() with no argument causes
939
+ * the process-wide umask to be written twice. This introduces a race condition between threads,
940
+ * and is a potential security vulnerability. There is no safe, cross-platform alternative API.
941
+ */
942
+ umask(): number;
937
943
  /**
938
944
  * Can only be set if not in worker thread.
939
945
  */
940
- umask(mask?: number): number;
946
+ umask(mask: string | number): number;
941
947
  uptime(): number;
942
948
  hrtime: HRTime;
943
949
  domain: Domain;
@@ -1140,6 +1146,7 @@ declare namespace NodeJS {
1140
1146
  ref(): this;
1141
1147
  refresh(): this;
1142
1148
  unref(): this;
1149
+ [Symbol.toPrimitive](): number;
1143
1150
  }
1144
1151
 
1145
1152
  class Immediate {
@@ -1154,6 +1161,7 @@ declare namespace NodeJS {
1154
1161
  ref(): this;
1155
1162
  refresh(): this;
1156
1163
  unref(): this;
1164
+ [Symbol.toPrimitive](): number;
1157
1165
  }
1158
1166
 
1159
1167
  class Module {
@@ -1174,7 +1182,8 @@ declare namespace NodeJS {
1174
1182
  id: string;
1175
1183
  filename: string;
1176
1184
  loaded: boolean;
1177
- parent: Module | null;
1185
+ /** @deprecated since 12.19.0 Please use `require.main` and `module.children` instead. */
1186
+ parent: Module | null | undefined;
1178
1187
  children: Module[];
1179
1188
  /**
1180
1189
  * @since 11.14.0
File without changes
@@ -177,7 +177,9 @@ declare module "http" {
177
177
  class ClientRequest extends OutgoingMessage {
178
178
  connection: Socket;
179
179
  socket: Socket;
180
- aborted: number;
180
+ aborted: boolean;
181
+ host: string;
182
+ protocol: string;
181
183
 
182
184
  constructor(url: string | URL | ClientRequestArgs, cb?: (res: IncomingMessage) => void);
183
185
 
@@ -317,6 +319,10 @@ declare module "http" {
317
319
  * Maximum number of sockets to allow per host. Default for Node 0.10 is 5, default for Node 0.12 is Infinity
318
320
  */
319
321
  maxSockets?: number;
322
+ /**
323
+ * Maximum number of sockets allowed for all hosts in total. Each request will use a new socket until the maximum is reached. Default: Infinity.
324
+ */
325
+ maxTotalSockets?: number;
320
326
  /**
321
327
  * Maximum number of sockets to leave open in a free state. Only relevant if keepAlive is set to true. Default = 256.
322
328
  */
@@ -330,6 +336,7 @@ declare module "http" {
330
336
  class Agent {
331
337
  maxFreeSockets: number;
332
338
  maxSockets: number;
339
+ maxTotalSockets: number;
333
340
  readonly sockets: {
334
341
  readonly [key: string]: Socket[];
335
342
  };
File without changes
File without changes
@@ -1,4 +1,4 @@
1
- // Type definitions for non-npm package Node.js 12.12
1
+ // Type definitions for non-npm package Node.js 12.19
2
2
  // Project: http://nodejs.org/
3
3
  // Definitions by: Microsoft TypeScript <https://github.com/Microsoft>
4
4
  // DefinitelyTyped <https://github.com/DefinitelyTyped>
File without changes
File without changes
File without changes
File without changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "12.12.69",
3
+ "version": "12.19.2",
4
4
  "description": "TypeScript definitions for Node.js",
5
5
  "license": "MIT",
6
6
  "contributors": [
@@ -231,6 +231,6 @@
231
231
  },
232
232
  "scripts": {},
233
233
  "dependencies": {},
234
- "typesPublisherContentHash": "61f7351a46af6aef73c34b6ed0d1789f50c9388d0eba62b56b8261433f176b58",
234
+ "typesPublisherContentHash": "1b26fba776dabe6181a3dbeafb1ab140da716d7a38c58f85a8915c13e0d805a6",
235
235
  "typeScriptVersion": "3.2"
236
236
  }
File without changes
@@ -45,6 +45,11 @@ declare module "perf_hooks" {
45
45
  */
46
46
  readonly environment: number;
47
47
 
48
+ /**
49
+ * The high resolution millisecond timestamp at which the Node.js environment was initialized.
50
+ */
51
+ readonly idleTime: number;
52
+
48
53
  /**
49
54
  * The high resolution millisecond timestamp at which the Node.js event loop exited.
50
55
  * If the event loop has not yet exited, the property has the value of -1.
@@ -69,6 +74,12 @@ declare module "perf_hooks" {
69
74
  readonly v8Start: number;
70
75
  }
71
76
 
77
+ interface EventLoopUtilization {
78
+ idle: number;
79
+ active: number;
80
+ utilization: number;
81
+ }
82
+
72
83
  interface Performance {
73
84
  /**
74
85
  * If name is not provided, removes all PerformanceMark objects from the Performance Timeline.
@@ -124,6 +135,16 @@ declare module "perf_hooks" {
124
135
  * @param fn
125
136
  */
126
137
  timerify<T extends (...optionalParams: any[]) => any>(fn: T): T;
138
+
139
+ /**
140
+ * eventLoopUtilization is similar to CPU utilization except that it is calculated using high precision wall-clock time.
141
+ * It represents the percentage of time the event loop has spent outside the event loop's event provider (e.g. epoll_wait).
142
+ * No other CPU idle time is taken into consideration.
143
+ *
144
+ * @param util1 The result of a previous call to eventLoopUtilization()
145
+ * @param util2 The result of a previous call to eventLoopUtilization() prior to util1
146
+ */
147
+ eventLoopUtilization(util1?: EventLoopUtilization, util2?: EventLoopUtilization): EventLoopUtilization;
127
148
  }
128
149
 
129
150
  interface PerformanceObserverEntryList {
File without changes
File without changes
File without changes
File without changes
@@ -131,13 +131,21 @@ declare module "repl" {
131
131
  */
132
132
  readonly context: Context;
133
133
  /**
134
- * The `Readable` stream from which REPL input will be read.
134
+ * Outdated alias for `input`.
135
135
  */
136
136
  readonly inputStream: NodeJS.ReadableStream;
137
137
  /**
138
- * The `Writable` stream to which REPL output will be written.
138
+ * Outdated alias for `output`.
139
139
  */
140
140
  readonly outputStream: NodeJS.WritableStream;
141
+ /**
142
+ * The `Readable` stream from which REPL input will be read.
143
+ */
144
+ readonly input: NodeJS.ReadableStream;
145
+ /**
146
+ * The `Writable` stream to which REPL output will be written.
147
+ */
148
+ readonly output: NodeJS.WritableStream;
141
149
  /**
142
150
  * The commands registered via `replServer.defineCommand()`.
143
151
  */
File without changes
File without changes
File without changes
@@ -641,6 +641,17 @@ declare module "tls" {
641
641
  * shared between applications. Unused by clients.
642
642
  */
643
643
  sessionIdContext?: string;
644
+ /**
645
+ * 48-bytes of cryptographically strong pseudo-random data.
646
+ * See Session Resumption for more information.
647
+ */
648
+ ticketKeys?: Buffer;
649
+ /**
650
+ * The number of seconds after which a TLS session created by the
651
+ * server will no longer be resumable. See Session Resumption for more
652
+ * information. Default: 300.
653
+ */
654
+ sessionTimeout?: number;
644
655
  }
645
656
 
646
657
  interface SecureContext {
@@ -664,7 +675,7 @@ declare module "tls" {
664
675
  * @deprecated
665
676
  */
666
677
  function createSecurePair(credentials?: SecureContext, isServer?: boolean, requestCert?: boolean, rejectUnauthorized?: boolean): SecurePair;
667
- function createSecureContext(details: SecureContextOptions): SecureContext;
678
+ function createSecureContext(options?: SecureContextOptions): SecureContext;
668
679
  function getCiphers(): string[];
669
680
 
670
681
  /**
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -2,6 +2,7 @@ declare module "worker_threads" {
2
2
  import { Context } from "vm";
3
3
  import { EventEmitter } from "events";
4
4
  import { Readable, Writable } from "stream";
5
+ import { promises } from "fs";
5
6
 
6
7
  const isMainThread: boolean;
7
8
  const parentPort: null | MessagePort;
@@ -15,7 +16,7 @@ declare module "worker_threads" {
15
16
  readonly port2: MessagePort;
16
17
  }
17
18
 
18
- type TransferListItem = ArrayBuffer | MessagePort;
19
+ type TransferListItem = ArrayBuffer | MessagePort | promises.FileHandle;
19
20
 
20
21
  class MessagePort extends EventEmitter {
21
22
  close(): void;
@@ -70,6 +71,7 @@ declare module "worker_threads" {
70
71
  * Additional data to send in the first worker message.
71
72
  */
72
73
  transferList?: TransferListItem[];
74
+ trackUnmanagedFds?: boolean;
73
75
  }
74
76
 
75
77
  interface ResourceLimits {
@@ -85,6 +87,11 @@ declare module "worker_threads" {
85
87
  * The size of a pre-allocated memory range used for generated code.
86
88
  */
87
89
  codeRangeSizeMb?: number;
90
+ /**
91
+ * The default maximum stack size for the thread. Small values may lead to unusable Worker instances.
92
+ * @default 4
93
+ */
94
+ stackSizeMb?: number;
88
95
  }
89
96
 
90
97
  class Worker extends EventEmitter {
@@ -92,6 +99,7 @@ declare module "worker_threads" {
92
99
  readonly stdout: Readable;
93
100
  readonly stderr: Readable;
94
101
  readonly threadId: number;
102
+ readonly resourceLimits?: ResourceLimits;
95
103
 
96
104
  constructor(filename: string, options?: WorkerOptions);
97
105
 
@@ -107,52 +115,72 @@ declare module "worker_threads" {
107
115
  addListener(event: "error", listener: (err: Error) => void): this;
108
116
  addListener(event: "exit", listener: (exitCode: number) => void): this;
109
117
  addListener(event: "message", listener: (value: any) => void): this;
118
+ addListener(event: "messageerror", listener: (error: Error) => void): this;
110
119
  addListener(event: "online", listener: () => void): this;
111
120
  addListener(event: string | symbol, listener: (...args: any[]) => void): this;
112
121
 
113
122
  emit(event: "error", err: Error): boolean;
114
123
  emit(event: "exit", exitCode: number): boolean;
115
124
  emit(event: "message", value: any): boolean;
125
+ emit(event: "messageerror", error: Error): boolean;
116
126
  emit(event: "online"): boolean;
117
127
  emit(event: string | symbol, ...args: any[]): boolean;
118
128
 
119
129
  on(event: "error", listener: (err: Error) => void): this;
120
130
  on(event: "exit", listener: (exitCode: number) => void): this;
121
131
  on(event: "message", listener: (value: any) => void): this;
132
+ on(event: "messageerror", listener: (error: Error) => void): this;
122
133
  on(event: "online", listener: () => void): this;
123
134
  on(event: string | symbol, listener: (...args: any[]) => void): this;
124
135
 
125
136
  once(event: "error", listener: (err: Error) => void): this;
126
137
  once(event: "exit", listener: (exitCode: number) => void): this;
127
138
  once(event: "message", listener: (value: any) => void): this;
139
+ once(event: "messageerror", listener: (error: Error) => void): this;
128
140
  once(event: "online", listener: () => void): this;
129
141
  once(event: string | symbol, listener: (...args: any[]) => void): this;
130
142
 
131
143
  prependListener(event: "error", listener: (err: Error) => void): this;
132
144
  prependListener(event: "exit", listener: (exitCode: number) => void): this;
133
145
  prependListener(event: "message", listener: (value: any) => void): this;
146
+ prependListener(event: "messageerror", listener: (error: Error) => void): this;
134
147
  prependListener(event: "online", listener: () => void): this;
135
148
  prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
136
149
 
137
150
  prependOnceListener(event: "error", listener: (err: Error) => void): this;
138
151
  prependOnceListener(event: "exit", listener: (exitCode: number) => void): this;
139
152
  prependOnceListener(event: "message", listener: (value: any) => void): this;
153
+ prependOnceListener(event: "messageerror", listener: (error: Error) => void): this;
140
154
  prependOnceListener(event: "online", listener: () => void): this;
141
155
  prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
142
156
 
143
157
  removeListener(event: "error", listener: (err: Error) => void): this;
144
158
  removeListener(event: "exit", listener: (exitCode: number) => void): this;
145
159
  removeListener(event: "message", listener: (value: any) => void): this;
160
+ removeListener(event: "messageerror", listener: (error: Error) => void): this;
146
161
  removeListener(event: "online", listener: () => void): this;
147
162
  removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
148
163
 
149
164
  off(event: "error", listener: (err: Error) => void): this;
150
165
  off(event: "exit", listener: (exitCode: number) => void): this;
151
166
  off(event: "message", listener: (value: any) => void): this;
167
+ off(event: "messageerror", listener: (error: Error) => void): this;
152
168
  off(event: "online", listener: () => void): this;
153
169
  off(event: string | symbol, listener: (...args: any[]) => void): this;
154
170
  }
155
171
 
172
+ /**
173
+ * Mark an object as not transferable.
174
+ * If `object` occurs in the transfer list of a `port.postMessage()` call, it will be ignored.
175
+ *
176
+ * In particular, this makes sense for objects that can be cloned, rather than transferred,
177
+ * and which are used by other objects on the sending side. For example, Node.js marks
178
+ * the `ArrayBuffer`s it uses for its Buffer pool with this.
179
+ *
180
+ * This operation cannot be undone.
181
+ */
182
+ function markAsUntransferable(object: object): void;
183
+
156
184
  /**
157
185
  * Transfer a `MessagePort` to a different `vm` Context. The original `port`
158
186
  * object will be rendered unusable, and the returned `MessagePort` instance will
@@ -20,6 +20,7 @@ declare module "zlib" {
20
20
  strategy?: number; // compression only
21
21
  dictionary?: NodeJS.ArrayBufferView | ArrayBuffer; // deflate/inflate only, empty dictionary by default
22
22
  info?: boolean;
23
+ maxOutputLength?: number;
23
24
  }
24
25
 
25
26
  interface BrotliOptions {
@@ -41,6 +42,7 @@ declare module "zlib" {
41
42
  */
42
43
  [key: number]: boolean | number;
43
44
  };
45
+ maxOutputLength?: number;
44
46
  }
45
47
 
46
48
  interface Zlib {
@@ -49,7 +51,8 @@ declare module "zlib" {
49
51
  readonly bytesWritten: number;
50
52
  shell?: boolean | string;
51
53
  close(callback?: () => void): void;
52
- flush(kind?: number | (() => void), callback?: () => void): void;
54
+ flush(kind?: number, callback?: () => void): void;
55
+ flush(callback?: () => void): void;
53
56
  }
54
57
 
55
58
  interface ZlibParams {
@@ -86,69 +89,76 @@ declare module "zlib" {
86
89
 
87
90
  function brotliCompress(buf: InputType, options: BrotliOptions, callback: CompressCallback): void;
88
91
  function brotliCompress(buf: InputType, callback: CompressCallback): void;
92
+ namespace brotliCompress {
93
+ function __promisify__(buffer: InputType, options?: BrotliOptions): Promise<Buffer>;
94
+ }
95
+
89
96
  function brotliCompressSync(buf: InputType, options?: BrotliOptions): Buffer;
97
+
90
98
  function brotliDecompress(buf: InputType, options: BrotliOptions, callback: CompressCallback): void;
91
99
  function brotliDecompress(buf: InputType, callback: CompressCallback): void;
100
+ namespace brotliDecompress {
101
+ function __promisify__(buffer: InputType, options?: BrotliOptions): Promise<Buffer>;
102
+ }
103
+
92
104
  function brotliDecompressSync(buf: InputType, options?: BrotliOptions): Buffer;
105
+
93
106
  function deflate(buf: InputType, callback: CompressCallback): void;
94
107
  function deflate(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
108
+ namespace deflate {
109
+ function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<Buffer>;
110
+ }
111
+
95
112
  function deflateSync(buf: InputType, options?: ZlibOptions): Buffer;
113
+
96
114
  function deflateRaw(buf: InputType, callback: CompressCallback): void;
97
115
  function deflateRaw(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
116
+ namespace deflateRaw {
117
+ function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<Buffer>;
118
+ }
119
+
98
120
  function deflateRawSync(buf: InputType, options?: ZlibOptions): Buffer;
121
+
99
122
  function gzip(buf: InputType, callback: CompressCallback): void;
100
123
  function gzip(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
124
+ namespace gzip {
125
+ function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<Buffer>;
126
+ }
127
+
101
128
  function gzipSync(buf: InputType, options?: ZlibOptions): Buffer;
129
+
102
130
  function gunzip(buf: InputType, callback: CompressCallback): void;
103
131
  function gunzip(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
132
+ namespace gunzip {
133
+ function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<Buffer>;
134
+ }
135
+
104
136
  function gunzipSync(buf: InputType, options?: ZlibOptions): Buffer;
137
+
105
138
  function inflate(buf: InputType, callback: CompressCallback): void;
106
139
  function inflate(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
140
+ namespace inflate {
141
+ function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<Buffer>;
142
+ }
143
+
107
144
  function inflateSync(buf: InputType, options?: ZlibOptions): Buffer;
145
+
108
146
  function inflateRaw(buf: InputType, callback: CompressCallback): void;
109
147
  function inflateRaw(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
148
+ namespace inflateRaw {
149
+ function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<Buffer>;
150
+ }
151
+
110
152
  function inflateRawSync(buf: InputType, options?: ZlibOptions): Buffer;
153
+
111
154
  function unzip(buf: InputType, callback: CompressCallback): void;
112
155
  function unzip(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
113
- function unzipSync(buf: InputType, options?: ZlibOptions): Buffer;
114
-
115
- namespace brotliCompress {
116
- function __promisify__(buffer: InputType, options: BrotliOptions): Promise<Buffer>;
117
- function __promisify__(buffer: InputType): Promise<Buffer>;
118
- }
119
- namespace brotliDecompress {
120
- function __promisify__(buffer: InputType, options: BrotliOptions): Promise<Buffer>;
121
- function __promisify__(buffer: InputType): Promise<Buffer>;
122
- }
123
- namespace deflate {
124
- function __promisify__(buffer: InputType): Promise<Buffer>;
125
- function __promisify__(buffer: InputType, options: ZlibOptions): Promise<Buffer>;
126
- }
127
- namespace deflateRaw {
128
- function __promisify__(buffer: InputType): Promise<Buffer>;
129
- function __promisify__(buffer: InputType, options: ZlibOptions): Promise<Buffer>;
130
- }
131
- namespace gzip {
132
- function __promisify__(buffer: InputType): Promise<Buffer>;
133
- function __promisify__(buffer: InputType, options: ZlibOptions): Promise<Buffer>;
134
- }
135
- namespace gunzip {
136
- function __promisify__(buffer: InputType): Promise<Buffer>;
137
- function __promisify__(buffer: InputType, options: ZlibOptions): Promise<Buffer>;
138
- }
139
- namespace inflate {
140
- function __promisify__(buffer: InputType): Promise<Buffer>;
141
- function __promisify__(buffer: InputType, options: ZlibOptions): Promise<Buffer>;
142
- }
143
- namespace inflateRaw {
144
- function __promisify__(buffer: InputType): Promise<Buffer>;
145
- function __promisify__(buffer: InputType, options: ZlibOptions): Promise<Buffer>;
146
- }
147
156
  namespace unzip {
148
- function __promisify__(buffer: InputType): Promise<Buffer>;
149
- function __promisify__(buffer: InputType, options: ZlibOptions): Promise<Buffer>;
157
+ function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<Buffer>;
150
158
  }
151
159
 
160
+ function unzipSync(buf: InputType, options?: ZlibOptions): Buffer;
161
+
152
162
  namespace constants {
153
163
  const BROTLI_DECODE: number;
154
164
  const BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: number;
@@ -226,165 +236,121 @@ declare module "zlib" {
226
236
  const INFLATERAW: number;
227
237
  const UNZIP: number;
228
238
 
229
- const Z_BEST_COMPRESSION: number;
230
- const Z_BEST_SPEED: number;
239
+ const Z_NO_FLUSH: number;
240
+ const Z_PARTIAL_FLUSH: number;
241
+ const Z_SYNC_FLUSH: number;
242
+ const Z_FULL_FLUSH: number;
243
+ const Z_FINISH: number;
231
244
  const Z_BLOCK: number;
232
- const Z_BUF_ERROR: number;
245
+ const Z_TREES: number;
246
+
247
+ const Z_OK: number;
248
+ const Z_STREAM_END: number;
249
+ const Z_NEED_DICT: number;
250
+ const Z_ERRNO: number;
251
+ const Z_STREAM_ERROR: number;
233
252
  const Z_DATA_ERROR: number;
253
+ const Z_MEM_ERROR: number;
254
+ const Z_BUF_ERROR: number;
255
+ const Z_VERSION_ERROR: number;
234
256
 
235
- const Z_DEFAULT_CHUNK: number;
257
+ const Z_NO_COMPRESSION: number;
258
+ const Z_BEST_SPEED: number;
259
+ const Z_BEST_COMPRESSION: number;
236
260
  const Z_DEFAULT_COMPRESSION: number;
237
- const Z_DEFAULT_LEVEL: number;
238
- const Z_DEFAULT_MEMLEVEL: number;
239
- const Z_DEFAULT_STRATEGY: number;
240
- const Z_DEFAULT_WINDOWBITS: number;
241
261
 
242
- const Z_ERRNO: number;
243
262
  const Z_FILTERED: number;
244
- const Z_FINISH: number;
245
- const Z_FIXED: number;
246
- const Z_FULL_FLUSH: number;
247
263
  const Z_HUFFMAN_ONLY: number;
248
- const Z_MAX_CHUNK: number;
249
- const Z_MAX_LEVEL: number;
250
- const Z_MAX_MEMLEVEL: number;
264
+ const Z_RLE: number;
265
+ const Z_FIXED: number;
266
+ const Z_DEFAULT_STRATEGY: number;
267
+
268
+ const Z_DEFAULT_WINDOWBITS: number;
269
+ const Z_MIN_WINDOWBITS: number;
251
270
  const Z_MAX_WINDOWBITS: number;
252
- const Z_MEM_ERROR: number;
271
+
253
272
  const Z_MIN_CHUNK: number;
254
- const Z_MIN_LEVEL: number;
273
+ const Z_MAX_CHUNK: number;
274
+ const Z_DEFAULT_CHUNK: number;
275
+
255
276
  const Z_MIN_MEMLEVEL: number;
256
- const Z_MIN_WINDOWBITS: number;
257
- const Z_NEED_DICT: number;
258
- const Z_NO_COMPRESSION: number;
259
- const Z_NO_FLUSH: number;
260
- const Z_OK: number;
261
- const Z_PARTIAL_FLUSH: number;
262
- const Z_RLE: number;
263
- const Z_STREAM_END: number;
264
- const Z_STREAM_ERROR: number;
265
- const Z_SYNC_FLUSH: number;
266
- const Z_VERSION_ERROR: number;
277
+ const Z_MAX_MEMLEVEL: number;
278
+ const Z_DEFAULT_MEMLEVEL: number;
279
+
280
+ const Z_MIN_LEVEL: number;
281
+ const Z_MAX_LEVEL: number;
282
+ const Z_DEFAULT_LEVEL: number;
283
+
267
284
  const ZLIB_VERNUM: number;
268
285
  }
269
286
 
270
- /**
271
- * @deprecated
272
- */
287
+ // Allowed flush values.
288
+ /** @deprecated Use `constants.Z_NO_FLUSH` */
273
289
  const Z_NO_FLUSH: number;
274
- /**
275
- * @deprecated
276
- */
290
+ /** @deprecated Use `constants.Z_PARTIAL_FLUSH` */
277
291
  const Z_PARTIAL_FLUSH: number;
278
- /**
279
- * @deprecated
280
- */
292
+ /** @deprecated Use `constants.Z_SYNC_FLUSH` */
281
293
  const Z_SYNC_FLUSH: number;
282
- /**
283
- * @deprecated
284
- */
294
+ /** @deprecated Use `constants.Z_FULL_FLUSH` */
285
295
  const Z_FULL_FLUSH: number;
286
- /**
287
- * @deprecated
288
- */
296
+ /** @deprecated Use `constants.Z_FINISH` */
289
297
  const Z_FINISH: number;
290
- /**
291
- * @deprecated
292
- */
298
+ /** @deprecated Use `constants.Z_BLOCK` */
293
299
  const Z_BLOCK: number;
294
- /**
295
- * @deprecated
296
- */
300
+ /** @deprecated Use `constants.Z_TREES` */
297
301
  const Z_TREES: number;
298
- /**
299
- * @deprecated
300
- */
302
+
303
+ // Return codes for the compression/decompression functions.
304
+ // Negative values are errors, positive values are used for special but normal events.
305
+ /** @deprecated Use `constants.Z_OK` */
301
306
  const Z_OK: number;
302
- /**
303
- * @deprecated
304
- */
307
+ /** @deprecated Use `constants.Z_STREAM_END` */
305
308
  const Z_STREAM_END: number;
306
- /**
307
- * @deprecated
308
- */
309
+ /** @deprecated Use `constants.Z_NEED_DICT` */
309
310
  const Z_NEED_DICT: number;
310
- /**
311
- * @deprecated
312
- */
311
+ /** @deprecated Use `constants.Z_ERRNO` */
313
312
  const Z_ERRNO: number;
314
- /**
315
- * @deprecated
316
- */
313
+ /** @deprecated Use `constants.Z_STREAM_ERROR` */
317
314
  const Z_STREAM_ERROR: number;
318
- /**
319
- * @deprecated
320
- */
315
+ /** @deprecated Use `constants.Z_DATA_ERROR` */
321
316
  const Z_DATA_ERROR: number;
322
- /**
323
- * @deprecated
324
- */
317
+ /** @deprecated Use `constants.Z_MEM_ERROR` */
325
318
  const Z_MEM_ERROR: number;
326
- /**
327
- * @deprecated
328
- */
319
+ /** @deprecated Use `constants.Z_BUF_ERROR` */
329
320
  const Z_BUF_ERROR: number;
330
- /**
331
- * @deprecated
332
- */
321
+ /** @deprecated Use `constants.Z_VERSION_ERROR` */
333
322
  const Z_VERSION_ERROR: number;
334
- /**
335
- * @deprecated
336
- */
323
+
324
+ // Compression levels.
325
+ /** @deprecated Use `constants.Z_NO_COMPRESSION` */
337
326
  const Z_NO_COMPRESSION: number;
338
- /**
339
- * @deprecated
340
- */
327
+ /** @deprecated Use `constants.Z_BEST_SPEED` */
341
328
  const Z_BEST_SPEED: number;
342
- /**
343
- * @deprecated
344
- */
329
+ /** @deprecated Use `constants.Z_BEST_COMPRESSION` */
345
330
  const Z_BEST_COMPRESSION: number;
346
- /**
347
- * @deprecated
348
- */
331
+ /** @deprecated Use `constants.Z_DEFAULT_COMPRESSION` */
349
332
  const Z_DEFAULT_COMPRESSION: number;
350
- /**
351
- * @deprecated
352
- */
333
+
334
+ // Compression strategy.
335
+ /** @deprecated Use `constants.Z_FILTERED` */
353
336
  const Z_FILTERED: number;
354
- /**
355
- * @deprecated
356
- */
337
+ /** @deprecated Use `constants.Z_HUFFMAN_ONLY` */
357
338
  const Z_HUFFMAN_ONLY: number;
358
- /**
359
- * @deprecated
360
- */
339
+ /** @deprecated Use `constants.Z_RLE` */
361
340
  const Z_RLE: number;
362
- /**
363
- * @deprecated
364
- */
341
+ /** @deprecated Use `constants.Z_FIXED` */
365
342
  const Z_FIXED: number;
366
- /**
367
- * @deprecated
368
- */
343
+ /** @deprecated Use `constants.Z_DEFAULT_STRATEGY` */
369
344
  const Z_DEFAULT_STRATEGY: number;
370
- /**
371
- * @deprecated
372
- */
345
+
346
+ /** @deprecated */
373
347
  const Z_BINARY: number;
374
- /**
375
- * @deprecated
376
- */
348
+ /** @deprecated */
377
349
  const Z_TEXT: number;
378
- /**
379
- * @deprecated
380
- */
350
+ /** @deprecated */
381
351
  const Z_ASCII: number;
382
- /**
383
- * @deprecated
384
- */
352
+ /** @deprecated */
385
353
  const Z_UNKNOWN: number;
386
- /**
387
- * @deprecated
388
- */
354
+ /** @deprecated */
389
355
  const Z_DEFLATED: number;
390
356
  }