@types/node 14.0.15 → 14.0.19

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/globals.d.ts CHANGED
@@ -1,107 +1,3 @@
1
- // This needs to be global to avoid TS2403 in case lib.dom.d.ts is present in the same build
2
- interface Console {
3
- Console: NodeJS.ConsoleConstructor;
4
- /**
5
- * A simple assertion test that verifies whether `value` is truthy.
6
- * If it is not, an `AssertionError` is thrown.
7
- * If provided, the error `message` is formatted using `util.format()` and used as the error message.
8
- */
9
- assert(value: any, message?: string, ...optionalParams: any[]): void;
10
- /**
11
- * When `stdout` is a TTY, calling `console.clear()` will attempt to clear the TTY.
12
- * When `stdout` is not a TTY, this method does nothing.
13
- */
14
- clear(): void;
15
- /**
16
- * Maintains an internal counter specific to `label` and outputs to `stdout` the number of times `console.count()` has been called with the given `label`.
17
- */
18
- count(label?: string): void;
19
- /**
20
- * Resets the internal counter specific to `label`.
21
- */
22
- countReset(label?: string): void;
23
- /**
24
- * The `console.debug()` function is an alias for {@link console.log()}.
25
- */
26
- debug(message?: any, ...optionalParams: any[]): void;
27
- /**
28
- * Uses {@link util.inspect()} on `obj` and prints the resulting string to `stdout`.
29
- * This function bypasses any custom `inspect()` function defined on `obj`.
30
- */
31
- dir(obj: any, options?: NodeJS.InspectOptions): void;
32
- /**
33
- * This method calls {@link console.log()} passing it the arguments received. Please note that this method does not produce any XML formatting
34
- */
35
- dirxml(...data: any[]): void;
36
- /**
37
- * Prints to `stderr` with newline.
38
- */
39
- error(message?: any, ...optionalParams: any[]): void;
40
- /**
41
- * Increases indentation of subsequent lines by two spaces.
42
- * If one or more `label`s are provided, those are printed first without the additional indentation.
43
- */
44
- group(...label: any[]): void;
45
- /**
46
- * The `console.groupCollapsed()` function is an alias for {@link console.group()}.
47
- */
48
- groupCollapsed(...label: any[]): void;
49
- /**
50
- * Decreases indentation of subsequent lines by two spaces.
51
- */
52
- groupEnd(): void;
53
- /**
54
- * The {@link console.info()} function is an alias for {@link console.log()}.
55
- */
56
- info(message?: any, ...optionalParams: any[]): void;
57
- /**
58
- * Prints to `stdout` with newline.
59
- */
60
- log(message?: any, ...optionalParams: any[]): void;
61
- /**
62
- * This method does not display anything unless used in the inspector.
63
- * Prints to `stdout` the array `array` formatted as a table.
64
- */
65
- table(tabularData: any, properties?: string[]): void;
66
- /**
67
- * Starts a timer that can be used to compute the duration of an operation. Timers are identified by a unique `label`.
68
- */
69
- time(label?: string): void;
70
- /**
71
- * Stops a timer that was previously started by calling {@link console.time()} and prints the result to `stdout`.
72
- */
73
- timeEnd(label?: string): void;
74
- /**
75
- * For a timer that was previously started by calling {@link console.time()}, prints the elapsed time and other `data` arguments to `stdout`.
76
- */
77
- timeLog(label?: string, ...data: any[]): void;
78
- /**
79
- * Prints to `stderr` the string 'Trace :', followed by the {@link util.format()} formatted message and stack trace to the current position in the code.
80
- */
81
- trace(message?: any, ...optionalParams: any[]): void;
82
- /**
83
- * The {@link console.warn()} function is an alias for {@link console.error()}.
84
- */
85
- warn(message?: any, ...optionalParams: any[]): void;
86
-
87
- // --- Inspector mode only ---
88
- /**
89
- * This method does not display anything unless used in the inspector.
90
- * Starts a JavaScript CPU profile with an optional label.
91
- */
92
- profile(label?: string): void;
93
- /**
94
- * This method does not display anything unless used in the inspector.
95
- * Stops the current JavaScript CPU profiling session if one has been started and prints the report to the Profiles panel of the inspector.
96
- */
97
- profileEnd(label?: string): void;
98
- /**
99
- * This method does not display anything unless used in the inspector.
100
- * Adds an event with the label `label` to the Timeline panel of the inspector.
101
- */
102
- timeStamp(label?: string): void;
103
- }
104
-
105
1
  // Declare "static" methods in Error
106
2
  interface ErrorConstructor {
107
3
  /** Create .stack property on a target object */
@@ -140,9 +36,6 @@ interface NodeRequire extends NodeJS.Require {}
140
36
  interface RequireResolve extends NodeJS.RequireResolve {}
141
37
  interface NodeModule extends NodeJS.Module {}
142
38
 
143
- declare var process: NodeJS.Process;
144
- declare var console: Console;
145
-
146
39
  declare var __filename: string;
147
40
  declare var __dirname: string;
148
41
 
@@ -169,243 +62,6 @@ declare var module: NodeModule;
169
62
  // Same as module.exports
170
63
  declare var exports: any;
171
64
 
172
- // Buffer class
173
- type BufferEncoding = "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "latin1" | "binary" | "hex";
174
-
175
- /**
176
- * Raw data is stored in instances of the Buffer class.
177
- * A Buffer is similar to an array of integers but corresponds to a raw memory allocation outside the V8 heap. A Buffer cannot be resized.
178
- * Valid string encodings: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex'
179
- */
180
- declare class Buffer extends Uint8Array {
181
- /**
182
- * Allocates a new buffer containing the given {str}.
183
- *
184
- * @param str String to store in buffer.
185
- * @param encoding encoding to use, optional. Default is 'utf8'
186
- * @deprecated since v10.0.0 - Use `Buffer.from(string[, encoding])` instead.
187
- */
188
- constructor(str: string, encoding?: BufferEncoding);
189
- /**
190
- * Allocates a new buffer of {size} octets.
191
- *
192
- * @param size count of octets to allocate.
193
- * @deprecated since v10.0.0 - Use `Buffer.alloc()` instead (also see `Buffer.allocUnsafe()`).
194
- */
195
- constructor(size: number);
196
- /**
197
- * Allocates a new buffer containing the given {array} of octets.
198
- *
199
- * @param array The octets to store.
200
- * @deprecated since v10.0.0 - Use `Buffer.from(array)` instead.
201
- */
202
- constructor(array: Uint8Array);
203
- /**
204
- * Produces a Buffer backed by the same allocated memory as
205
- * the given {ArrayBuffer}/{SharedArrayBuffer}.
206
- *
207
- *
208
- * @param arrayBuffer The ArrayBuffer with which to share memory.
209
- * @deprecated since v10.0.0 - Use `Buffer.from(arrayBuffer[, byteOffset[, length]])` instead.
210
- */
211
- constructor(arrayBuffer: ArrayBuffer | SharedArrayBuffer);
212
- /**
213
- * Allocates a new buffer containing the given {array} of octets.
214
- *
215
- * @param array The octets to store.
216
- * @deprecated since v10.0.0 - Use `Buffer.from(array)` instead.
217
- */
218
- constructor(array: any[]);
219
- /**
220
- * Copies the passed {buffer} data onto a new {Buffer} instance.
221
- *
222
- * @param buffer The buffer to copy.
223
- * @deprecated since v10.0.0 - Use `Buffer.from(buffer)` instead.
224
- */
225
- constructor(buffer: Buffer);
226
- /**
227
- * When passed a reference to the .buffer property of a TypedArray instance,
228
- * the newly created Buffer will share the same allocated memory as the TypedArray.
229
- * The optional {byteOffset} and {length} arguments specify a memory range
230
- * within the {arrayBuffer} that will be shared by the Buffer.
231
- *
232
- * @param arrayBuffer The .buffer property of any TypedArray or a new ArrayBuffer()
233
- */
234
- static from(arrayBuffer: ArrayBuffer | SharedArrayBuffer, byteOffset?: number, length?: number): Buffer;
235
- /**
236
- * Creates a new Buffer using the passed {data}
237
- * @param data data to create a new Buffer
238
- */
239
- static from(data: number[]): Buffer;
240
- static from(data: Uint8Array): Buffer;
241
- /**
242
- * Creates a new buffer containing the coerced value of an object
243
- * A `TypeError` will be thrown if {obj} has not mentioned methods or is not of other type appropriate for `Buffer.from()` variants.
244
- * @param obj An object supporting `Symbol.toPrimitive` or `valueOf()`.
245
- */
246
- static from(obj: { valueOf(): string | object } | { [Symbol.toPrimitive](hint: 'string'): string }, byteOffset?: number, length?: number): Buffer;
247
- /**
248
- * Creates a new Buffer containing the given JavaScript string {str}.
249
- * If provided, the {encoding} parameter identifies the character encoding.
250
- * If not provided, {encoding} defaults to 'utf8'.
251
- */
252
- static from(str: string, encoding?: BufferEncoding): Buffer;
253
- /**
254
- * Creates a new Buffer using the passed {data}
255
- * @param values to create a new Buffer
256
- */
257
- static of(...items: number[]): Buffer;
258
- /**
259
- * Returns true if {obj} is a Buffer
260
- *
261
- * @param obj object to test.
262
- */
263
- static isBuffer(obj: any): obj is Buffer;
264
- /**
265
- * Returns true if {encoding} is a valid encoding argument.
266
- * Valid string encodings in Node 0.12: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex'
267
- *
268
- * @param encoding string to test.
269
- */
270
- static isEncoding(encoding: string): encoding is BufferEncoding;
271
- /**
272
- * Gives the actual byte length of a string. encoding defaults to 'utf8'.
273
- * This is not the same as String.prototype.length since that returns the number of characters in a string.
274
- *
275
- * @param string string to test.
276
- * @param encoding encoding used to evaluate (defaults to 'utf8')
277
- */
278
- static byteLength(
279
- string: string | NodeJS.ArrayBufferView | ArrayBuffer | SharedArrayBuffer,
280
- encoding?: BufferEncoding
281
- ): number;
282
- /**
283
- * Returns a buffer which is the result of concatenating all the buffers in the list together.
284
- *
285
- * If the list has no items, or if the totalLength is 0, then it returns a zero-length buffer.
286
- * If the list has exactly one item, then the first item of the list is returned.
287
- * If the list has more than one item, then a new Buffer is created.
288
- *
289
- * @param list An array of Buffer objects to concatenate
290
- * @param totalLength Total length of the buffers when concatenated.
291
- * If totalLength is not provided, it is read from the buffers in the list. However, this adds an additional loop to the function, so it is faster to provide the length explicitly.
292
- */
293
- static concat(list: Uint8Array[], totalLength?: number): Buffer;
294
- /**
295
- * The same as buf1.compare(buf2).
296
- */
297
- static compare(buf1: Uint8Array, buf2: Uint8Array): number;
298
- /**
299
- * Allocates a new buffer of {size} octets.
300
- *
301
- * @param size count of octets to allocate.
302
- * @param fill if specified, buffer will be initialized by calling buf.fill(fill).
303
- * If parameter is omitted, buffer will be filled with zeros.
304
- * @param encoding encoding used for call to buf.fill while initalizing
305
- */
306
- static alloc(size: number, fill?: string | Buffer | number, encoding?: BufferEncoding): Buffer;
307
- /**
308
- * Allocates a new buffer of {size} octets, leaving memory not initialized, so the contents
309
- * of the newly created Buffer are unknown and may contain sensitive data.
310
- *
311
- * @param size count of octets to allocate
312
- */
313
- static allocUnsafe(size: number): Buffer;
314
- /**
315
- * Allocates a new non-pooled buffer of {size} octets, leaving memory not initialized, so the contents
316
- * of the newly created Buffer are unknown and may contain sensitive data.
317
- *
318
- * @param size count of octets to allocate
319
- */
320
- static allocUnsafeSlow(size: number): Buffer;
321
- /**
322
- * This is the number of bytes used to determine the size of pre-allocated, internal Buffer instances used for pooling. This value may be modified.
323
- */
324
- static poolSize: number;
325
-
326
- write(string: string, encoding?: BufferEncoding): number;
327
- write(string: string, offset: number, encoding?: BufferEncoding): number;
328
- write(string: string, offset: number, length: number, encoding?: BufferEncoding): number;
329
- toString(encoding?: BufferEncoding, start?: number, end?: number): string;
330
- toJSON(): { type: 'Buffer'; data: number[] };
331
- equals(otherBuffer: Uint8Array): boolean;
332
- compare(
333
- otherBuffer: Uint8Array,
334
- targetStart?: number,
335
- targetEnd?: number,
336
- sourceStart?: number,
337
- sourceEnd?: number
338
- ): number;
339
- copy(targetBuffer: Uint8Array, targetStart?: number, sourceStart?: number, sourceEnd?: number): number;
340
- /**
341
- * Returns a new `Buffer` that references **the same memory as the original**, but offset and cropped by the start and end indices.
342
- *
343
- * This method is incompatible with `Uint8Array#slice()`, which returns a copy of the original memory.
344
- *
345
- * @param begin Where the new `Buffer` will start. Default: `0`.
346
- * @param end Where the new `Buffer` will end (not inclusive). Default: `buf.length`.
347
- */
348
- slice(begin?: number, end?: number): Buffer;
349
- /**
350
- * Returns a new `Buffer` that references **the same memory as the original**, but offset and cropped by the start and end indices.
351
- *
352
- * This method is compatible with `Uint8Array#subarray()`.
353
- *
354
- * @param begin Where the new `Buffer` will start. Default: `0`.
355
- * @param end Where the new `Buffer` will end (not inclusive). Default: `buf.length`.
356
- */
357
- subarray(begin?: number, end?: number): Buffer;
358
- writeUIntLE(value: number, offset: number, byteLength: number): number;
359
- writeUIntBE(value: number, offset: number, byteLength: number): number;
360
- writeIntLE(value: number, offset: number, byteLength: number): number;
361
- writeIntBE(value: number, offset: number, byteLength: number): number;
362
- readUIntLE(offset: number, byteLength: number): number;
363
- readUIntBE(offset: number, byteLength: number): number;
364
- readIntLE(offset: number, byteLength: number): number;
365
- readIntBE(offset: number, byteLength: number): number;
366
- readUInt8(offset?: number): number;
367
- readUInt16LE(offset?: number): number;
368
- readUInt16BE(offset?: number): number;
369
- readUInt32LE(offset?: number): number;
370
- readUInt32BE(offset?: number): number;
371
- readInt8(offset?: number): number;
372
- readInt16LE(offset?: number): number;
373
- readInt16BE(offset?: number): number;
374
- readInt32LE(offset?: number): number;
375
- readInt32BE(offset?: number): number;
376
- readFloatLE(offset?: number): number;
377
- readFloatBE(offset?: number): number;
378
- readDoubleLE(offset?: number): number;
379
- readDoubleBE(offset?: number): number;
380
- reverse(): this;
381
- swap16(): Buffer;
382
- swap32(): Buffer;
383
- swap64(): Buffer;
384
- writeUInt8(value: number, offset?: number): number;
385
- writeUInt16LE(value: number, offset?: number): number;
386
- writeUInt16BE(value: number, offset?: number): number;
387
- writeUInt32LE(value: number, offset?: number): number;
388
- writeUInt32BE(value: number, offset?: number): number;
389
- writeInt8(value: number, offset?: number): number;
390
- writeInt16LE(value: number, offset?: number): number;
391
- writeInt16BE(value: number, offset?: number): number;
392
- writeInt32LE(value: number, offset?: number): number;
393
- writeInt32BE(value: number, offset?: number): number;
394
- writeFloatLE(value: number, offset?: number): number;
395
- writeFloatBE(value: number, offset?: number): number;
396
- writeDoubleLE(value: number, offset?: number): number;
397
- writeDoubleBE(value: number, offset?: number): number;
398
-
399
- fill(value: string | Uint8Array | number, offset?: number, end?: number, encoding?: BufferEncoding): this;
400
-
401
- indexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number;
402
- lastIndexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number;
403
- entries(): IterableIterator<[number, number]>;
404
- includes(value: string | number | Buffer, byteOffset?: number, encoding?: BufferEncoding): boolean;
405
- keys(): IterableIterator<number>;
406
- values(): IterableIterator<number>;
407
- }
408
-
409
65
  /*----------------------------------------------*
410
66
  * *
411
67
  * GLOBAL INTERFACES *
@@ -453,20 +109,6 @@ declare namespace NodeJS {
453
109
  sorted?: boolean | ((a: string, b: string) => number);
454
110
  }
455
111
 
456
- interface ConsoleConstructorOptions {
457
- stdout: WritableStream;
458
- stderr?: WritableStream;
459
- ignoreErrors?: boolean;
460
- colorMode?: boolean | 'auto';
461
- inspectOptions?: InspectOptions;
462
- }
463
-
464
- interface ConsoleConstructor {
465
- prototype: Console;
466
- new(stdout: WritableStream, stderr?: WritableStream, ignoreErrors?: boolean): Console;
467
- new(options: ConsoleConstructorOptions): Console;
468
- }
469
-
470
112
  interface CallSite {
471
113
  /**
472
114
  * Value of "this"
@@ -549,25 +191,6 @@ declare namespace NodeJS {
549
191
  stack?: string;
550
192
  }
551
193
 
552
- interface EventEmitter {
553
- addListener(event: string | symbol, listener: (...args: any[]) => void): this;
554
- on(event: string | symbol, listener: (...args: any[]) => void): this;
555
- once(event: string | symbol, listener: (...args: any[]) => void): this;
556
- removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
557
- off(event: string | symbol, listener: (...args: any[]) => void): this;
558
- removeAllListeners(event?: string | symbol): this;
559
- setMaxListeners(n: number): this;
560
- getMaxListeners(): number;
561
- listeners(event: string | symbol): Function[];
562
- rawListeners(event: string | symbol): Function[];
563
- emit(event: string | symbol, ...args: any[]): boolean;
564
- listenerCount(type: string | symbol): number;
565
- // Added in Node 6...
566
- prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
567
- prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
568
- eventNames(): Array<string | symbol>;
569
- }
570
-
571
194
  interface ReadableStream extends EventEmitter {
572
195
  readable: boolean;
573
196
  read(size?: number): string | Buffer;
@@ -593,390 +216,6 @@ declare namespace NodeJS {
593
216
 
594
217
  interface ReadWriteStream extends ReadableStream, WritableStream { }
595
218
 
596
- interface Domain extends EventEmitter {
597
- run<T>(fn: (...args: any[]) => T, ...args: any[]): T;
598
- add(emitter: EventEmitter | Timer): void;
599
- remove(emitter: EventEmitter | Timer): void;
600
- bind<T extends Function>(cb: T): T;
601
- intercept<T extends Function>(cb: T): T;
602
-
603
- addListener(event: string, listener: (...args: any[]) => void): this;
604
- on(event: string, listener: (...args: any[]) => void): this;
605
- once(event: string, listener: (...args: any[]) => void): this;
606
- removeListener(event: string, listener: (...args: any[]) => void): this;
607
- removeAllListeners(event?: string): this;
608
- }
609
-
610
- interface MemoryUsage {
611
- rss: number;
612
- heapTotal: number;
613
- heapUsed: number;
614
- external: number;
615
- arrayBuffers: number;
616
- }
617
-
618
- interface CpuUsage {
619
- user: number;
620
- system: number;
621
- }
622
-
623
- interface ProcessRelease {
624
- name: string;
625
- sourceUrl?: string;
626
- headersUrl?: string;
627
- libUrl?: string;
628
- lts?: string;
629
- }
630
-
631
- interface ProcessVersions {
632
- http_parser: string;
633
- node: string;
634
- v8: string;
635
- ares: string;
636
- uv: string;
637
- zlib: string;
638
- modules: string;
639
- openssl: string;
640
- }
641
-
642
- type Platform = 'aix'
643
- | 'android'
644
- | 'darwin'
645
- | 'freebsd'
646
- | 'linux'
647
- | 'openbsd'
648
- | 'sunos'
649
- | 'win32'
650
- | 'cygwin'
651
- | 'netbsd';
652
-
653
- type Signals =
654
- "SIGABRT" | "SIGALRM" | "SIGBUS" | "SIGCHLD" | "SIGCONT" | "SIGFPE" | "SIGHUP" | "SIGILL" | "SIGINT" | "SIGIO" |
655
- "SIGIOT" | "SIGKILL" | "SIGPIPE" | "SIGPOLL" | "SIGPROF" | "SIGPWR" | "SIGQUIT" | "SIGSEGV" | "SIGSTKFLT" |
656
- "SIGSTOP" | "SIGSYS" | "SIGTERM" | "SIGTRAP" | "SIGTSTP" | "SIGTTIN" | "SIGTTOU" | "SIGUNUSED" | "SIGURG" |
657
- "SIGUSR1" | "SIGUSR2" | "SIGVTALRM" | "SIGWINCH" | "SIGXCPU" | "SIGXFSZ" | "SIGBREAK" | "SIGLOST" | "SIGINFO";
658
-
659
- type MultipleResolveType = 'resolve' | 'reject';
660
-
661
- type BeforeExitListener = (code: number) => void;
662
- type DisconnectListener = () => void;
663
- type ExitListener = (code: number) => void;
664
- type RejectionHandledListener = (promise: Promise<any>) => void;
665
- type UncaughtExceptionListener = (error: Error) => void;
666
- type UnhandledRejectionListener = (reason: {} | null | undefined, promise: Promise<any>) => void;
667
- type WarningListener = (warning: Error) => void;
668
- type MessageListener = (message: any, sendHandle: any) => void;
669
- type SignalsListener = (signal: Signals) => void;
670
- type NewListenerListener = (type: string | symbol, listener: (...args: any[]) => void) => void;
671
- type RemoveListenerListener = (type: string | symbol, listener: (...args: any[]) => void) => void;
672
- type MultipleResolveListener = (type: MultipleResolveType, promise: Promise<any>, value: any) => void;
673
-
674
- interface Socket extends ReadWriteStream {
675
- isTTY?: true;
676
- }
677
-
678
- // Alias for compatibility
679
- interface ProcessEnv extends Dict<string> {}
680
-
681
- interface HRTime {
682
- (time?: [number, number]): [number, number];
683
- }
684
-
685
- interface ProcessReport {
686
- /**
687
- * Directory where the report is written.
688
- * working directory of the Node.js process.
689
- * @default '' indicating that reports are written to the current
690
- */
691
- directory: string;
692
-
693
- /**
694
- * Filename where the report is written.
695
- * The default value is the empty string.
696
- * @default '' the output filename will be comprised of a timestamp,
697
- * PID, and sequence number.
698
- */
699
- filename: string;
700
-
701
- /**
702
- * Returns a JSON-formatted diagnostic report for the running process.
703
- * The report's JavaScript stack trace is taken from err, if present.
704
- */
705
- getReport(err?: Error): string;
706
-
707
- /**
708
- * If true, a diagnostic report is generated on fatal errors,
709
- * such as out of memory errors or failed C++ assertions.
710
- * @default false
711
- */
712
- reportOnFatalError: boolean;
713
-
714
- /**
715
- * If true, a diagnostic report is generated when the process
716
- * receives the signal specified by process.report.signal.
717
- * @defaul false
718
- */
719
- reportOnSignal: boolean;
720
-
721
- /**
722
- * If true, a diagnostic report is generated on uncaught exception.
723
- * @default false
724
- */
725
- reportOnUncaughtException: boolean;
726
-
727
- /**
728
- * The signal used to trigger the creation of a diagnostic report.
729
- * @default 'SIGUSR2'
730
- */
731
- signal: Signals;
732
-
733
- /**
734
- * Writes a diagnostic report to a file. If filename is not provided, the default filename
735
- * includes the date, time, PID, and a sequence number.
736
- * The report's JavaScript stack trace is taken from err, if present.
737
- *
738
- * @param fileName Name of the file where the report is written.
739
- * This should be a relative path, that will be appended to the directory specified in
740
- * `process.report.directory`, or the current working directory of the Node.js process,
741
- * if unspecified.
742
- * @param error A custom error used for reporting the JavaScript stack.
743
- * @return Filename of the generated report.
744
- */
745
- writeReport(fileName?: string): string;
746
- writeReport(error?: Error): string;
747
- writeReport(fileName?: string, err?: Error): string;
748
- }
749
-
750
- interface ResourceUsage {
751
- fsRead: number;
752
- fsWrite: number;
753
- involuntaryContextSwitches: number;
754
- ipcReceived: number;
755
- ipcSent: number;
756
- majorPageFault: number;
757
- maxRSS: number;
758
- minorPageFault: number;
759
- sharedMemorySize: number;
760
- signalsCount: number;
761
- swappedOut: number;
762
- systemCPUTime: number;
763
- unsharedDataSize: number;
764
- unsharedStackSize: number;
765
- userCPUTime: number;
766
- voluntaryContextSwitches: number;
767
- }
768
-
769
- interface Process extends EventEmitter {
770
- /**
771
- * Can also be a tty.WriteStream, not typed due to limitations.
772
- */
773
- stdout: WriteStream;
774
- /**
775
- * Can also be a tty.WriteStream, not typed due to limitations.
776
- */
777
- stderr: WriteStream;
778
- stdin: ReadStream;
779
- openStdin(): Socket;
780
- argv: string[];
781
- argv0: string;
782
- execArgv: string[];
783
- execPath: string;
784
- abort(): void;
785
- chdir(directory: string): void;
786
- cwd(): string;
787
- debugPort: number;
788
- emitWarning(warning: string | Error, name?: string, ctor?: Function): void;
789
- env: ProcessEnv;
790
- exit(code?: number): never;
791
- exitCode?: number;
792
- getgid(): number;
793
- setgid(id: number | string): void;
794
- getuid(): number;
795
- setuid(id: number | string): void;
796
- geteuid(): number;
797
- seteuid(id: number | string): void;
798
- getegid(): number;
799
- setegid(id: number | string): void;
800
- getgroups(): number[];
801
- setgroups(groups: Array<string | number>): void;
802
- setUncaughtExceptionCaptureCallback(cb: ((err: Error) => void) | null): void;
803
- hasUncaughtExceptionCaptureCallback(): boolean;
804
- version: string;
805
- versions: ProcessVersions;
806
- config: {
807
- target_defaults: {
808
- cflags: any[];
809
- default_configuration: string;
810
- defines: string[];
811
- include_dirs: string[];
812
- libraries: string[];
813
- };
814
- variables: {
815
- clang: number;
816
- host_arch: string;
817
- node_install_npm: boolean;
818
- node_install_waf: boolean;
819
- node_prefix: string;
820
- node_shared_openssl: boolean;
821
- node_shared_v8: boolean;
822
- node_shared_zlib: boolean;
823
- node_use_dtrace: boolean;
824
- node_use_etw: boolean;
825
- node_use_openssl: boolean;
826
- target_arch: string;
827
- v8_no_strict_aliasing: number;
828
- v8_use_snapshot: boolean;
829
- visibility: string;
830
- };
831
- };
832
- kill(pid: number, signal?: string | number): true;
833
- pid: number;
834
- ppid: number;
835
- title: string;
836
- arch: string;
837
- platform: Platform;
838
- memoryUsage(): MemoryUsage;
839
- cpuUsage(previousValue?: CpuUsage): CpuUsage;
840
- nextTick(callback: Function, ...args: any[]): void;
841
- release: ProcessRelease;
842
- features: {
843
- inspector: boolean;
844
- debug: boolean;
845
- uv: boolean;
846
- ipv6: boolean;
847
- tls_alpn: boolean;
848
- tls_sni: boolean;
849
- tls_ocsp: boolean;
850
- tls: boolean;
851
- };
852
- /**
853
- * Can only be set if not in worker thread.
854
- */
855
- umask(mask: number): number;
856
- uptime(): number;
857
- hrtime: HRTime;
858
- domain: Domain;
859
-
860
- // Worker
861
- send?(message: any, sendHandle?: any, options?: { swallowErrors?: boolean}, callback?: (error: Error | null) => void): boolean;
862
- disconnect(): void;
863
- connected: boolean;
864
-
865
- /**
866
- * The `process.allowedNodeEnvironmentFlags` property is a special,
867
- * read-only `Set` of flags allowable within the [`NODE_OPTIONS`][]
868
- * environment variable.
869
- */
870
- allowedNodeEnvironmentFlags: ReadonlySet<string>;
871
-
872
- /**
873
- * Only available with `--experimental-report`
874
- */
875
- report?: ProcessReport;
876
-
877
- resourceUsage(): ResourceUsage;
878
-
879
- /* EventEmitter */
880
- addListener(event: "beforeExit", listener: BeforeExitListener): this;
881
- addListener(event: "disconnect", listener: DisconnectListener): this;
882
- addListener(event: "exit", listener: ExitListener): this;
883
- addListener(event: "rejectionHandled", listener: RejectionHandledListener): this;
884
- addListener(event: "uncaughtException", listener: UncaughtExceptionListener): this;
885
- addListener(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this;
886
- addListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
887
- addListener(event: "warning", listener: WarningListener): this;
888
- addListener(event: "message", listener: MessageListener): this;
889
- addListener(event: Signals, listener: SignalsListener): this;
890
- addListener(event: "newListener", listener: NewListenerListener): this;
891
- addListener(event: "removeListener", listener: RemoveListenerListener): this;
892
- addListener(event: "multipleResolves", listener: MultipleResolveListener): this;
893
-
894
- emit(event: "beforeExit", code: number): boolean;
895
- emit(event: "disconnect"): boolean;
896
- emit(event: "exit", code: number): boolean;
897
- emit(event: "rejectionHandled", promise: Promise<any>): boolean;
898
- emit(event: "uncaughtException", error: Error): boolean;
899
- emit(event: "uncaughtExceptionMonitor", error: Error): boolean;
900
- emit(event: "unhandledRejection", reason: any, promise: Promise<any>): boolean;
901
- emit(event: "warning", warning: Error): boolean;
902
- emit(event: "message", message: any, sendHandle: any): this;
903
- emit(event: Signals, signal: Signals): boolean;
904
- emit(event: "newListener", eventName: string | symbol, listener: (...args: any[]) => void): this;
905
- emit(event: "removeListener", eventName: string, listener: (...args: any[]) => void): this;
906
- emit(event: "multipleResolves", listener: MultipleResolveListener): this;
907
-
908
- on(event: "beforeExit", listener: BeforeExitListener): this;
909
- on(event: "disconnect", listener: DisconnectListener): this;
910
- on(event: "exit", listener: ExitListener): this;
911
- on(event: "rejectionHandled", listener: RejectionHandledListener): this;
912
- on(event: "uncaughtException", listener: UncaughtExceptionListener): this;
913
- on(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this;
914
- on(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
915
- on(event: "warning", listener: WarningListener): this;
916
- on(event: "message", listener: MessageListener): this;
917
- on(event: Signals, listener: SignalsListener): this;
918
- on(event: "newListener", listener: NewListenerListener): this;
919
- on(event: "removeListener", listener: RemoveListenerListener): this;
920
- on(event: "multipleResolves", listener: MultipleResolveListener): this;
921
- on(event: string | symbol, listener: (...args: any[]) => void): this;
922
-
923
- once(event: "beforeExit", listener: BeforeExitListener): this;
924
- once(event: "disconnect", listener: DisconnectListener): this;
925
- once(event: "exit", listener: ExitListener): this;
926
- once(event: "rejectionHandled", listener: RejectionHandledListener): this;
927
- once(event: "uncaughtException", listener: UncaughtExceptionListener): this;
928
- once(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this;
929
- once(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
930
- once(event: "warning", listener: WarningListener): this;
931
- once(event: "message", listener: MessageListener): this;
932
- once(event: Signals, listener: SignalsListener): this;
933
- once(event: "newListener", listener: NewListenerListener): this;
934
- once(event: "removeListener", listener: RemoveListenerListener): this;
935
- once(event: "multipleResolves", listener: MultipleResolveListener): this;
936
-
937
- prependListener(event: "beforeExit", listener: BeforeExitListener): this;
938
- prependListener(event: "disconnect", listener: DisconnectListener): this;
939
- prependListener(event: "exit", listener: ExitListener): this;
940
- prependListener(event: "rejectionHandled", listener: RejectionHandledListener): this;
941
- prependListener(event: "uncaughtException", listener: UncaughtExceptionListener): this;
942
- prependListener(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this;
943
- prependListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
944
- prependListener(event: "warning", listener: WarningListener): this;
945
- prependListener(event: "message", listener: MessageListener): this;
946
- prependListener(event: Signals, listener: SignalsListener): this;
947
- prependListener(event: "newListener", listener: NewListenerListener): this;
948
- prependListener(event: "removeListener", listener: RemoveListenerListener): this;
949
- prependListener(event: "multipleResolves", listener: MultipleResolveListener): this;
950
-
951
- prependOnceListener(event: "beforeExit", listener: BeforeExitListener): this;
952
- prependOnceListener(event: "disconnect", listener: DisconnectListener): this;
953
- prependOnceListener(event: "exit", listener: ExitListener): this;
954
- prependOnceListener(event: "rejectionHandled", listener: RejectionHandledListener): this;
955
- prependOnceListener(event: "uncaughtException", listener: UncaughtExceptionListener): this;
956
- prependOnceListener(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this;
957
- prependOnceListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
958
- prependOnceListener(event: "warning", listener: WarningListener): this;
959
- prependOnceListener(event: "message", listener: MessageListener): this;
960
- prependOnceListener(event: Signals, listener: SignalsListener): this;
961
- prependOnceListener(event: "newListener", listener: NewListenerListener): this;
962
- prependOnceListener(event: "removeListener", listener: RemoveListenerListener): this;
963
- prependOnceListener(event: "multipleResolves", listener: MultipleResolveListener): this;
964
-
965
- listeners(event: "beforeExit"): BeforeExitListener[];
966
- listeners(event: "disconnect"): DisconnectListener[];
967
- listeners(event: "exit"): ExitListener[];
968
- listeners(event: "rejectionHandled"): RejectionHandledListener[];
969
- listeners(event: "uncaughtException"): UncaughtExceptionListener[];
970
- listeners(event: "uncaughtExceptionMonitor"): UncaughtExceptionListener[];
971
- listeners(event: "unhandledRejection"): UnhandledRejectionListener[];
972
- listeners(event: "warning"): WarningListener[];
973
- listeners(event: "message"): MessageListener[];
974
- listeners(event: Signals): SignalsListener[];
975
- listeners(event: "newListener"): NewListenerListener[];
976
- listeners(event: "removeListener"): RemoveListenerListener[];
977
- listeners(event: "multipleResolves"): MultipleResolveListener[];
978
- }
979
-
980
219
  interface Global {
981
220
  Array: typeof Array;
982
221
  ArrayBuffer: typeof ArrayBuffer;
@@ -1019,7 +258,6 @@ declare namespace NodeJS {
1019
258
  clearImmediate: (immediateId: Immediate) => void;
1020
259
  clearInterval: (intervalId: Timeout) => void;
1021
260
  clearTimeout: (timeoutId: Timeout) => void;
1022
- console: typeof console;
1023
261
  decodeURI: typeof decodeURI;
1024
262
  decodeURIComponent: typeof decodeURIComponent;
1025
263
  encodeURI: typeof encodeURI;
@@ -1031,7 +269,6 @@ declare namespace NodeJS {
1031
269
  isNaN: typeof isNaN;
1032
270
  parseFloat: typeof parseFloat;
1033
271
  parseInt: typeof parseInt;
1034
- process: Process;
1035
272
  setImmediate: (callback: (...args: any[]) => void, ...args: any[]) => Immediate;
1036
273
  setInterval: (callback: (...args: any[]) => void, ms: number, ...args: any[]) => Timeout;
1037
274
  setTimeout: (callback: (...args: any[]) => void, ms: number, ...args: any[]) => Timeout;