@types/node 16.18.86 → 16.18.88

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 (55) hide show
  1. node v16.18/README.md +2 -2
  2. node v16.18/package.json +3 -15
  3. node v16.18/ts4.8/assert/strict.d.ts +0 -8
  4. node v16.18/ts4.8/assert.d.ts +0 -986
  5. node v16.18/ts4.8/async_hooks.d.ts +0 -501
  6. node v16.18/ts4.8/buffer.d.ts +0 -2266
  7. node v16.18/ts4.8/child_process.d.ts +0 -1536
  8. node v16.18/ts4.8/cluster.d.ts +0 -436
  9. node v16.18/ts4.8/console.d.ts +0 -412
  10. node v16.18/ts4.8/constants.d.ts +0 -19
  11. node v16.18/ts4.8/crypto.d.ts +0 -4346
  12. node v16.18/ts4.8/dgram.d.ts +0 -591
  13. node v16.18/ts4.8/diagnostics_channel.d.ts +0 -191
  14. node v16.18/ts4.8/dns/promises.d.ts +0 -372
  15. node v16.18/ts4.8/dns.d.ts +0 -796
  16. node v16.18/ts4.8/dom-events.d.ts +0 -122
  17. node v16.18/ts4.8/domain.d.ts +0 -170
  18. node v16.18/ts4.8/events.d.ts +0 -714
  19. node v16.18/ts4.8/fs/promises.d.ts +0 -1124
  20. node v16.18/ts4.8/fs.d.ts +0 -4030
  21. node v16.18/ts4.8/globals.d.ts +0 -291
  22. node v16.18/ts4.8/globals.global.d.ts +0 -1
  23. node v16.18/ts4.8/http.d.ts +0 -1586
  24. node v16.18/ts4.8/http2.d.ts +0 -2353
  25. node v16.18/ts4.8/https.d.ts +0 -534
  26. node v16.18/ts4.8/index.d.ts +0 -86
  27. node v16.18/ts4.8/inspector.d.ts +0 -2743
  28. node v16.18/ts4.8/module.d.ts +0 -221
  29. node v16.18/ts4.8/net.d.ts +0 -858
  30. node v16.18/ts4.8/os.d.ts +0 -455
  31. node v16.18/ts4.8/path.d.ts +0 -191
  32. node v16.18/ts4.8/perf_hooks.d.ts +0 -603
  33. node v16.18/ts4.8/process.d.ts +0 -1525
  34. node v16.18/ts4.8/punycode.d.ts +0 -117
  35. node v16.18/ts4.8/querystring.d.ts +0 -141
  36. node v16.18/ts4.8/readline.d.ts +0 -553
  37. node v16.18/ts4.8/repl.d.ts +0 -430
  38. node v16.18/ts4.8/stream/consumers.d.ts +0 -12
  39. node v16.18/ts4.8/stream/promises.d.ts +0 -83
  40. node v16.18/ts4.8/stream/web.d.ts +0 -392
  41. node v16.18/ts4.8/stream.d.ts +0 -1494
  42. node v16.18/ts4.8/string_decoder.d.ts +0 -67
  43. node v16.18/ts4.8/test.d.ts +0 -190
  44. node v16.18/ts4.8/timers/promises.d.ts +0 -93
  45. node v16.18/ts4.8/timers.d.ts +0 -109
  46. node v16.18/ts4.8/tls.d.ts +0 -1099
  47. node v16.18/ts4.8/trace_events.d.ts +0 -161
  48. node v16.18/ts4.8/tty.d.ts +0 -204
  49. node v16.18/ts4.8/url.d.ts +0 -885
  50. node v16.18/ts4.8/util.d.ts +0 -1689
  51. node v16.18/ts4.8/v8.d.ts +0 -626
  52. node v16.18/ts4.8/vm.d.ts +0 -507
  53. node v16.18/ts4.8/wasi.d.ts +0 -158
  54. node v16.18/ts4.8/worker_threads.d.ts +0 -649
  55. node v16.18/ts4.8/zlib.d.ts +0 -517
@@ -1,436 +0,0 @@
1
- /**
2
- * A single instance of Node.js runs in a single thread. To take advantage of
3
- * multi-core systems, the user will sometimes want to launch a cluster of Node.js
4
- * processes to handle the load.
5
- *
6
- * The cluster module allows easy creation of child processes that all share
7
- * server ports.
8
- *
9
- * ```js
10
- * import cluster from 'cluster';
11
- * import http from 'http';
12
- * import { cpus } from 'os';
13
- * import process from 'process';
14
- *
15
- * const numCPUs = cpus().length;
16
- *
17
- * if (cluster.isPrimary) {
18
- * console.log(`Primary ${process.pid} is running`);
19
- *
20
- * // Fork workers.
21
- * for (let i = 0; i < numCPUs; i++) {
22
- * cluster.fork();
23
- * }
24
- *
25
- * cluster.on('exit', (worker, code, signal) => {
26
- * console.log(`worker ${worker.process.pid} died`);
27
- * });
28
- * } else {
29
- * // Workers can share any TCP connection
30
- * // In this case it is an HTTP server
31
- * http.createServer((req, res) => {
32
- * res.writeHead(200);
33
- * res.end('hello world\n');
34
- * }).listen(8000);
35
- *
36
- * console.log(`Worker ${process.pid} started`);
37
- * }
38
- * ```
39
- *
40
- * Running Node.js will now share port 8000 between the workers:
41
- *
42
- * ```console
43
- * $ node server.js
44
- * Primary 3596 is running
45
- * Worker 4324 started
46
- * Worker 4520 started
47
- * Worker 6056 started
48
- * Worker 5644 started
49
- * ```
50
- *
51
- * On Windows, it is not yet possible to set up a named pipe server in a worker.
52
- * @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/cluster.js)
53
- */
54
- declare module "cluster" {
55
- import * as child from "node:child_process";
56
- import EventEmitter = require("node:events");
57
- import * as net from "node:net";
58
- type SerializationType = "json" | "advanced";
59
- export interface ClusterSettings {
60
- execArgv?: string[] | undefined; // default: process.execArgv
61
- exec?: string | undefined;
62
- args?: string[] | undefined;
63
- silent?: boolean | undefined;
64
- stdio?: any[] | undefined;
65
- uid?: number | undefined;
66
- gid?: number | undefined;
67
- inspectPort?: number | (() => number) | undefined;
68
- serialization?: SerializationType | undefined;
69
- cwd?: string | undefined;
70
- windowsHide?: boolean | undefined;
71
- }
72
- export interface Address {
73
- address: string;
74
- port: number;
75
- addressType: number | "udp4" | "udp6"; // 4, 6, -1, "udp4", "udp6"
76
- }
77
- /**
78
- * A `Worker` object contains all public information and method about a worker.
79
- * In the primary it can be obtained using `cluster.workers`. In a worker
80
- * it can be obtained using `cluster.worker`.
81
- * @since v0.7.0
82
- */
83
- export class Worker extends EventEmitter {
84
- /**
85
- * Each new worker is given its own unique id, this id is stored in the`id`.
86
- *
87
- * While a worker is alive, this is the key that indexes it in`cluster.workers`.
88
- * @since v0.8.0
89
- */
90
- id: number;
91
- /**
92
- * All workers are created using `child_process.fork()`, the returned object
93
- * from this function is stored as `.process`. In a worker, the global `process`is stored.
94
- *
95
- * See: `Child Process module`.
96
- *
97
- * Workers will call `process.exit(0)` if the `'disconnect'` event occurs
98
- * on `process` and `.exitedAfterDisconnect` is not `true`. This protects against
99
- * accidental disconnection.
100
- * @since v0.7.0
101
- */
102
- process: child.ChildProcess;
103
- /**
104
- * Send a message to a worker or primary, optionally with a handle.
105
- *
106
- * In the primary this sends a message to a specific worker. It is identical to `ChildProcess.send()`.
107
- *
108
- * In a worker this sends a message to the primary. It is identical to`process.send()`.
109
- *
110
- * This example will echo back all messages from the primary:
111
- *
112
- * ```js
113
- * if (cluster.isPrimary) {
114
- * const worker = cluster.fork();
115
- * worker.send('hi there');
116
- *
117
- * } else if (cluster.isWorker) {
118
- * process.on('message', (msg) => {
119
- * process.send(msg);
120
- * });
121
- * }
122
- * ```
123
- * @since v0.7.0
124
- * @param options The `options` argument, if present, is an object used to parameterize the sending of certain types of handles. `options` supports the following properties:
125
- */
126
- send(message: child.Serializable, callback?: (error: Error | null) => void): boolean;
127
- send(
128
- message: child.Serializable,
129
- sendHandle: child.SendHandle,
130
- callback?: (error: Error | null) => void,
131
- ): boolean;
132
- send(
133
- message: child.Serializable,
134
- sendHandle: child.SendHandle,
135
- options?: child.MessageOptions,
136
- callback?: (error: Error | null) => void,
137
- ): boolean;
138
- /**
139
- * This function will kill the worker. In the primary, it does this
140
- * by disconnecting the `worker.process`, and once disconnected, killing
141
- * with `signal`. In the worker, it does it by disconnecting the channel,
142
- * and then exiting with code `0`.
143
- *
144
- * Because `kill()` attempts to gracefully disconnect the worker process, it is
145
- * susceptible to waiting indefinitely for the disconnect to complete. For example,
146
- * if the worker enters an infinite loop, a graceful disconnect will never occur.
147
- * If the graceful disconnect behavior is not needed, use `worker.process.kill()`.
148
- *
149
- * Causes `.exitedAfterDisconnect` to be set.
150
- *
151
- * This method is aliased as `worker.destroy()` for backward compatibility.
152
- *
153
- * In a worker, `process.kill()` exists, but it is not this function;
154
- * it is `kill()`.
155
- * @since v0.9.12
156
- * @param [signal='SIGTERM'] Name of the kill signal to send to the worker process.
157
- */
158
- kill(signal?: string): void;
159
- destroy(signal?: string): void;
160
- /**
161
- * In a worker, this function will close all servers, wait for the `'close'` event
162
- * on those servers, and then disconnect the IPC channel.
163
- *
164
- * In the primary, an internal message is sent to the worker causing it to call`.disconnect()` on itself.
165
- *
166
- * Causes `.exitedAfterDisconnect` to be set.
167
- *
168
- * After a server is closed, it will no longer accept new connections,
169
- * but connections may be accepted by any other listening worker. Existing
170
- * connections will be allowed to close as usual. When no more connections exist,
171
- * see `server.close()`, the IPC channel to the worker will close allowing it
172
- * to die gracefully.
173
- *
174
- * The above applies _only_ to server connections, client connections are not
175
- * automatically closed by workers, and disconnect does not wait for them to close
176
- * before exiting.
177
- *
178
- * In a worker, `process.disconnect` exists, but it is not this function;
179
- * it is `disconnect()`.
180
- *
181
- * Because long living server connections may block workers from disconnecting, it
182
- * may be useful to send a message, so application specific actions may be taken to
183
- * close them. It also may be useful to implement a timeout, killing a worker if
184
- * the `'disconnect'` event has not been emitted after some time.
185
- *
186
- * ```js
187
- * if (cluster.isPrimary) {
188
- * const worker = cluster.fork();
189
- * let timeout;
190
- *
191
- * worker.on('listening', (address) => {
192
- * worker.send('shutdown');
193
- * worker.disconnect();
194
- * timeout = setTimeout(() => {
195
- * worker.kill();
196
- * }, 2000);
197
- * });
198
- *
199
- * worker.on('disconnect', () => {
200
- * clearTimeout(timeout);
201
- * });
202
- *
203
- * } else if (cluster.isWorker) {
204
- * const net = require('net');
205
- * const server = net.createServer((socket) => {
206
- * // Connections never end
207
- * });
208
- *
209
- * server.listen(8000);
210
- *
211
- * process.on('message', (msg) => {
212
- * if (msg === 'shutdown') {
213
- * // Initiate graceful close of any connections to server
214
- * }
215
- * });
216
- * }
217
- * ```
218
- * @since v0.7.7
219
- * @return A reference to `worker`.
220
- */
221
- disconnect(): void;
222
- /**
223
- * This function returns `true` if the worker is connected to its primary via its
224
- * IPC channel, `false` otherwise. A worker is connected to its primary after it
225
- * has been created. It is disconnected after the `'disconnect'` event is emitted.
226
- * @since v0.11.14
227
- */
228
- isConnected(): boolean;
229
- /**
230
- * This function returns `true` if the worker's process has terminated (either
231
- * because of exiting or being signaled). Otherwise, it returns `false`.
232
- *
233
- * ```js
234
- * import cluster from 'cluster';
235
- * import http from 'http';
236
- * import { cpus } from 'os';
237
- * import process from 'process';
238
- *
239
- * const numCPUs = cpus().length;
240
- *
241
- * if (cluster.isPrimary) {
242
- * console.log(`Primary ${process.pid} is running`);
243
- *
244
- * // Fork workers.
245
- * for (let i = 0; i < numCPUs; i++) {
246
- * cluster.fork();
247
- * }
248
- *
249
- * cluster.on('fork', (worker) => {
250
- * console.log('worker is dead:', worker.isDead());
251
- * });
252
- *
253
- * cluster.on('exit', (worker, code, signal) => {
254
- * console.log('worker is dead:', worker.isDead());
255
- * });
256
- * } else {
257
- * // Workers can share any TCP connection. In this case, it is an HTTP server.
258
- * http.createServer((req, res) => {
259
- * res.writeHead(200);
260
- * res.end(`Current process\n ${process.pid}`);
261
- * process.kill(process.pid);
262
- * }).listen(8000);
263
- * }
264
- * ```
265
- * @since v0.11.14
266
- */
267
- isDead(): boolean;
268
- /**
269
- * This property is `true` if the worker exited due to `.kill()` or`.disconnect()`. If the worker exited any other way, it is `false`. If the
270
- * worker has not exited, it is `undefined`.
271
- *
272
- * The boolean `worker.exitedAfterDisconnect` allows distinguishing between
273
- * voluntary and accidental exit, the primary may choose not to respawn a worker
274
- * based on this value.
275
- *
276
- * ```js
277
- * cluster.on('exit', (worker, code, signal) => {
278
- * if (worker.exitedAfterDisconnect === true) {
279
- * console.log('Oh, it was just voluntary – no need to worry');
280
- * }
281
- * });
282
- *
283
- * // kill worker
284
- * worker.kill();
285
- * ```
286
- * @since v6.0.0
287
- */
288
- exitedAfterDisconnect: boolean;
289
- /**
290
- * events.EventEmitter
291
- * 1. disconnect
292
- * 2. error
293
- * 3. exit
294
- * 4. listening
295
- * 5. message
296
- * 6. online
297
- */
298
- addListener(event: string, listener: (...args: any[]) => void): this;
299
- addListener(event: "disconnect", listener: () => void): this;
300
- addListener(event: "error", listener: (error: Error) => void): this;
301
- addListener(event: "exit", listener: (code: number, signal: string) => void): this;
302
- addListener(event: "listening", listener: (address: Address) => void): this;
303
- addListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
304
- addListener(event: "online", listener: () => void): this;
305
- emit(event: string | symbol, ...args: any[]): boolean;
306
- emit(event: "disconnect"): boolean;
307
- emit(event: "error", error: Error): boolean;
308
- emit(event: "exit", code: number, signal: string): boolean;
309
- emit(event: "listening", address: Address): boolean;
310
- emit(event: "message", message: any, handle: net.Socket | net.Server): boolean;
311
- emit(event: "online"): boolean;
312
- on(event: string, listener: (...args: any[]) => void): this;
313
- on(event: "disconnect", listener: () => void): this;
314
- on(event: "error", listener: (error: Error) => void): this;
315
- on(event: "exit", listener: (code: number, signal: string) => void): this;
316
- on(event: "listening", listener: (address: Address) => void): this;
317
- on(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
318
- on(event: "online", listener: () => void): this;
319
- once(event: string, listener: (...args: any[]) => void): this;
320
- once(event: "disconnect", listener: () => void): this;
321
- once(event: "error", listener: (error: Error) => void): this;
322
- once(event: "exit", listener: (code: number, signal: string) => void): this;
323
- once(event: "listening", listener: (address: Address) => void): this;
324
- once(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
325
- once(event: "online", listener: () => void): this;
326
- prependListener(event: string, listener: (...args: any[]) => void): this;
327
- prependListener(event: "disconnect", listener: () => void): this;
328
- prependListener(event: "error", listener: (error: Error) => void): this;
329
- prependListener(event: "exit", listener: (code: number, signal: string) => void): this;
330
- prependListener(event: "listening", listener: (address: Address) => void): this;
331
- prependListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
332
- prependListener(event: "online", listener: () => void): this;
333
- prependOnceListener(event: string, listener: (...args: any[]) => void): this;
334
- prependOnceListener(event: "disconnect", listener: () => void): this;
335
- prependOnceListener(event: "error", listener: (error: Error) => void): this;
336
- prependOnceListener(event: "exit", listener: (code: number, signal: string) => void): this;
337
- prependOnceListener(event: "listening", listener: (address: Address) => void): this;
338
- prependOnceListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
339
- prependOnceListener(event: "online", listener: () => void): this;
340
- }
341
- export interface Cluster extends EventEmitter {
342
- disconnect(callback?: () => void): void;
343
- fork(env?: any): Worker;
344
- /** @deprecated since v16.0.0 - use isPrimary. */
345
- readonly isMaster: boolean;
346
- readonly isPrimary: boolean;
347
- readonly isWorker: boolean;
348
- schedulingPolicy: number;
349
- readonly settings: ClusterSettings;
350
- /** @deprecated since v16.0.0 - use setupPrimary. */
351
- setupMaster(settings?: ClusterSettings): void;
352
- /**
353
- * `setupPrimary` is used to change the default 'fork' behavior. Once called, the settings will be present in cluster.settings.
354
- */
355
- setupPrimary(settings?: ClusterSettings): void;
356
- readonly worker?: Worker | undefined;
357
- readonly workers?: NodeJS.Dict<Worker> | undefined;
358
- readonly SCHED_NONE: number;
359
- readonly SCHED_RR: number;
360
- /**
361
- * events.EventEmitter
362
- * 1. disconnect
363
- * 2. exit
364
- * 3. fork
365
- * 4. listening
366
- * 5. message
367
- * 6. online
368
- * 7. setup
369
- */
370
- addListener(event: string, listener: (...args: any[]) => void): this;
371
- addListener(event: "disconnect", listener: (worker: Worker) => void): this;
372
- addListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this;
373
- addListener(event: "fork", listener: (worker: Worker) => void): this;
374
- addListener(event: "listening", listener: (worker: Worker, address: Address) => void): this;
375
- addListener(
376
- event: "message",
377
- listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void,
378
- ): this; // the handle is a net.Socket or net.Server object, or undefined.
379
- addListener(event: "online", listener: (worker: Worker) => void): this;
380
- addListener(event: "setup", listener: (settings: ClusterSettings) => void): this;
381
- emit(event: string | symbol, ...args: any[]): boolean;
382
- emit(event: "disconnect", worker: Worker): boolean;
383
- emit(event: "exit", worker: Worker, code: number, signal: string): boolean;
384
- emit(event: "fork", worker: Worker): boolean;
385
- emit(event: "listening", worker: Worker, address: Address): boolean;
386
- emit(event: "message", worker: Worker, message: any, handle: net.Socket | net.Server): boolean;
387
- emit(event: "online", worker: Worker): boolean;
388
- emit(event: "setup", settings: ClusterSettings): boolean;
389
- on(event: string, listener: (...args: any[]) => void): this;
390
- on(event: "disconnect", listener: (worker: Worker) => void): this;
391
- on(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this;
392
- on(event: "fork", listener: (worker: Worker) => void): this;
393
- on(event: "listening", listener: (worker: Worker, address: Address) => void): this;
394
- on(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
395
- on(event: "online", listener: (worker: Worker) => void): this;
396
- on(event: "setup", listener: (settings: ClusterSettings) => void): this;
397
- once(event: string, listener: (...args: any[]) => void): this;
398
- once(event: "disconnect", listener: (worker: Worker) => void): this;
399
- once(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this;
400
- once(event: "fork", listener: (worker: Worker) => void): this;
401
- once(event: "listening", listener: (worker: Worker, address: Address) => void): this;
402
- once(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
403
- once(event: "online", listener: (worker: Worker) => void): this;
404
- once(event: "setup", listener: (settings: ClusterSettings) => void): this;
405
- prependListener(event: string, listener: (...args: any[]) => void): this;
406
- prependListener(event: "disconnect", listener: (worker: Worker) => void): this;
407
- prependListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this;
408
- prependListener(event: "fork", listener: (worker: Worker) => void): this;
409
- prependListener(event: "listening", listener: (worker: Worker, address: Address) => void): this;
410
- // the handle is a net.Socket or net.Server object, or undefined.
411
- prependListener(
412
- event: "message",
413
- listener: (worker: Worker, message: any, handle?: net.Socket | net.Server) => void,
414
- ): this;
415
- prependListener(event: "online", listener: (worker: Worker) => void): this;
416
- prependListener(event: "setup", listener: (settings: ClusterSettings) => void): this;
417
- prependOnceListener(event: string, listener: (...args: any[]) => void): this;
418
- prependOnceListener(event: "disconnect", listener: (worker: Worker) => void): this;
419
- prependOnceListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this;
420
- prependOnceListener(event: "fork", listener: (worker: Worker) => void): this;
421
- prependOnceListener(event: "listening", listener: (worker: Worker, address: Address) => void): this;
422
- // the handle is a net.Socket or net.Server object, or undefined.
423
- prependOnceListener(
424
- event: "message",
425
- listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void,
426
- ): this;
427
- prependOnceListener(event: "online", listener: (worker: Worker) => void): this;
428
- prependOnceListener(event: "setup", listener: (settings: ClusterSettings) => void): this;
429
- }
430
- const cluster: Cluster;
431
- export default cluster;
432
- }
433
- declare module "node:cluster" {
434
- export * from "cluster";
435
- export { default as default } from "cluster";
436
- }