1 |
|
2 | interface Console {
|
3 | Console: NodeJS.ConsoleConstructor;
|
4 | |
5 |
|
6 |
|
7 |
|
8 |
|
9 | assert(value: any, message?: string, ...optionalParams: any[]): void;
|
10 | |
11 |
|
12 |
|
13 |
|
14 | clear(): void;
|
15 | |
16 |
|
17 |
|
18 | count(label?: string): void;
|
19 | |
20 |
|
21 |
|
22 | countReset(label?: string): void;
|
23 | |
24 |
|
25 |
|
26 | debug(message?: any, ...optionalParams: any[]): void;
|
27 | |
28 |
|
29 |
|
30 |
|
31 | dir(obj: any, options?: NodeJS.InspectOptions): void;
|
32 | |
33 |
|
34 |
|
35 | dirxml(...data: any[]): void;
|
36 | |
37 |
|
38 |
|
39 | error(message?: any, ...optionalParams: any[]): void;
|
40 | |
41 |
|
42 |
|
43 |
|
44 | group(...label: any[]): void;
|
45 | |
46 |
|
47 |
|
48 | groupCollapsed(...label: any[]): void;
|
49 | |
50 |
|
51 |
|
52 | groupEnd(): void;
|
53 | |
54 |
|
55 |
|
56 | info(message?: any, ...optionalParams: any[]): void;
|
57 | |
58 |
|
59 |
|
60 | log(message?: any, ...optionalParams: any[]): void;
|
61 | |
62 |
|
63 |
|
64 |
|
65 | table(tabularData: any, properties?: string[]): void;
|
66 | |
67 |
|
68 |
|
69 | time(label?: string): void;
|
70 | |
71 |
|
72 |
|
73 | timeEnd(label?: string): void;
|
74 | |
75 |
|
76 |
|
77 | timeLog(label?: string, ...data: any[]): void;
|
78 | |
79 |
|
80 |
|
81 | trace(message?: any, ...optionalParams: any[]): void;
|
82 | |
83 |
|
84 |
|
85 | warn(message?: any, ...optionalParams: any[]): void;
|
86 |
|
87 |
|
88 | |
89 |
|
90 |
|
91 |
|
92 |
|
93 |
|
94 | markTimeline(label?: string): void;
|
95 | |
96 |
|
97 |
|
98 |
|
99 | profile(label?: string): void;
|
100 | |
101 |
|
102 |
|
103 |
|
104 | profileEnd(label?: string): void;
|
105 | |
106 |
|
107 |
|
108 |
|
109 | timeStamp(label?: string): void;
|
110 | |
111 |
|
112 |
|
113 |
|
114 |
|
115 |
|
116 | timeline(label?: string): void;
|
117 | |
118 |
|
119 |
|
120 |
|
121 |
|
122 |
|
123 | timelineEnd(label?: string): void;
|
124 | }
|
125 |
|
126 | interface Error {
|
127 | stack?: string;
|
128 | }
|
129 |
|
130 |
|
131 | interface ErrorConstructor {
|
132 |
|
133 | captureStackTrace(targetObject: Object, constructorOpt?: Function): void;
|
134 |
|
135 | |
136 |
|
137 |
|
138 |
|
139 |
|
140 | prepareStackTrace?: (err: Error, stackTraces: NodeJS.CallSite[]) => any;
|
141 |
|
142 | stackTraceLimit: number;
|
143 | }
|
144 |
|
145 | interface SymbolConstructor {
|
146 | readonly observable: symbol;
|
147 | }
|
148 |
|
149 |
|
150 | interface String {
|
151 |
|
152 | trimLeft(): string;
|
153 |
|
154 | trimRight(): string;
|
155 | }
|
156 |
|
157 | interface ImportMeta {
|
158 | url: string;
|
159 | }
|
160 |
|
161 |
|
162 |
|
163 |
|
164 |
|
165 |
|
166 | declare var process: NodeJS.Process;
|
167 | declare var global: NodeJS.Global;
|
168 | declare var console: Console;
|
169 |
|
170 | declare var __filename: string;
|
171 | declare var __dirname: string;
|
172 |
|
173 | declare function setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timeout;
|
174 | declare namespace setTimeout {
|
175 | function __promisify__(ms: number): Promise<void>;
|
176 | function __promisify__<T>(ms: number, value: T): Promise<T>;
|
177 | }
|
178 | declare function clearTimeout(timeoutId: NodeJS.Timeout): void;
|
179 | declare function setInterval(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timeout;
|
180 | declare function clearInterval(intervalId: NodeJS.Timeout): void;
|
181 | declare function setImmediate(callback: (...args: any[]) => void, ...args: any[]): NodeJS.Immediate;
|
182 | declare namespace setImmediate {
|
183 | function __promisify__(): Promise<void>;
|
184 | function __promisify__<T>(value: T): Promise<T>;
|
185 | }
|
186 | declare function clearImmediate(immediateId: NodeJS.Immediate): void;
|
187 |
|
188 | declare function queueMicrotask(callback: () => void): void;
|
189 |
|
190 |
|
191 | interface NodeRequireFunction {
|
192 |
|
193 | (id: string): any;
|
194 | }
|
195 |
|
196 | interface NodeRequire extends NodeRequireFunction {
|
197 | resolve: RequireResolve;
|
198 | cache: any;
|
199 | |
200 |
|
201 |
|
202 | extensions: NodeExtensions;
|
203 | main: NodeModule | undefined;
|
204 | }
|
205 |
|
206 | interface RequireResolve {
|
207 | (id: string, options?: { paths?: string[]; }): string;
|
208 | paths(request: string): string[] | null;
|
209 | }
|
210 |
|
211 | interface NodeExtensions {
|
212 | '.js': (m: NodeModule, filename: string) => any;
|
213 | '.json': (m: NodeModule, filename: string) => any;
|
214 | '.node': (m: NodeModule, filename: string) => any;
|
215 | [ext: string]: (m: NodeModule, filename: string) => any;
|
216 | }
|
217 |
|
218 | declare var require: NodeRequire;
|
219 |
|
220 | interface NodeModule {
|
221 | exports: any;
|
222 | require: NodeRequireFunction;
|
223 | id: string;
|
224 | filename: string;
|
225 | loaded: boolean;
|
226 | parent: NodeModule | null;
|
227 | children: NodeModule[];
|
228 | paths: string[];
|
229 | }
|
230 |
|
231 | declare var module: NodeModule;
|
232 |
|
233 | // Same as module.exports
|
234 | declare var exports: any;
|
235 |
|
236 | // Buffer class
|
237 | type BufferEncoding = "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "latin1" | "binary" | "hex";
|
238 |
|
239 | interface Buffer {
|
240 | constructor: typeof Buffer;
|
241 | }
|
242 |
|
243 | /**
|
244 | * Raw data is stored in instances of the Buffer class.
|
245 | * 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.
|
246 | * Valid string encodings: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex'
|
247 | */
|
248 | declare class Buffer extends Uint8Array {
|
249 | |
250 |
|
251 |
|
252 |
|
253 |
|
254 |
|
255 |
|
256 | constructor(str: string, encoding?: BufferEncoding);
|
257 | /**
|
258 | * Allocates a new buffer of {size} octets.
|
259 | *
|
260 | * @param size count of octets to allocate.
|
261 | * @deprecated since v10.0.0 - Use `Buffer.alloc()` instead (also see `Buffer.allocUnsafe()`).
|
262 | */
|
263 | constructor(size: number);
|
264 | /**
|
265 | * Allocates a new buffer containing the given {array} of octets.
|
266 | *
|
267 | * @param array The octets to store.
|
268 | * @deprecated since v10.0.0 - Use `Buffer.from(array)` instead.
|
269 | */
|
270 | constructor(array: Uint8Array);
|
271 | /**
|
272 | * Produces a Buffer backed by the same allocated memory as
|
273 | * the given {ArrayBuffer}/{SharedArrayBuffer}.
|
274 | *
|
275 | *
|
276 | * @param arrayBuffer The ArrayBuffer with which to share memory.
|
277 | * @deprecated since v10.0.0 - Use `Buffer.from(arrayBuffer[, byteOffset[, length]])` instead.
|
278 | */
|
279 | constructor(arrayBuffer: ArrayBuffer | SharedArrayBuffer);
|
280 | /**
|
281 | * Allocates a new buffer containing the given {array} of octets.
|
282 | *
|
283 | * @param array The octets to store.
|
284 | * @deprecated since v10.0.0 - Use `Buffer.from(array)` instead.
|
285 | */
|
286 | constructor(array: any[]);
|
287 | /**
|
288 | * Copies the passed {buffer} data onto a new {Buffer} instance.
|
289 | *
|
290 | * @param buffer The buffer to copy.
|
291 | * @deprecated since v10.0.0 - Use `Buffer.from(buffer)` instead.
|
292 | */
|
293 | constructor(buffer: Buffer);
|
294 | /**
|
295 | * When passed a reference to the .buffer property of a TypedArray instance,
|
296 | * the newly created Buffer will share the same allocated memory as the TypedArray.
|
297 | * The optional {byteOffset} and {length} arguments specify a memory range
|
298 | * within the {arrayBuffer} that will be shared by the Buffer.
|
299 | *
|
300 | * @param arrayBuffer The .buffer property of any TypedArray or a new ArrayBuffer()
|
301 | */
|
302 | static from(arrayBuffer: ArrayBuffer | SharedArrayBuffer, byteOffset?: number, length?: number): Buffer;
|
303 | |
304 |
|
305 |
|
306 |
|
307 | static from(data: number[]): Buffer;
|
308 | static from(data: Uint8Array): Buffer;
|
309 | |
310 |
|
311 |
|
312 |
|
313 |
|
314 | static from(str: string, encoding?: BufferEncoding): Buffer;
|
315 | |
316 |
|
317 |
|
318 |
|
319 | static of(...items: number[]): Buffer;
|
320 | |
321 |
|
322 |
|
323 |
|
324 |
|
325 | static isBuffer(obj: any): obj is Buffer;
|
326 | |
327 |
|
328 |
|
329 |
|
330 |
|
331 |
|
332 | static isEncoding(encoding: string): encoding is BufferEncoding;
|
333 | |
334 |
|
335 |
|
336 |
|
337 |
|
338 |
|
339 |
|
340 | static byteLength(
|
341 | string: string | NodeJS.ArrayBufferView | ArrayBuffer | SharedArrayBuffer,
|
342 | encoding?: BufferEncoding
|
343 | ): number;
|
344 | |
345 |
|
346 |
|
347 |
|
348 |
|
349 |
|
350 |
|
351 |
|
352 |
|
353 |
|
354 |
|
355 | static concat(list: Uint8Array[], totalLength?: number): Buffer;
|
356 | |
357 |
|
358 |
|
359 | static compare(buf1: Uint8Array, buf2: Uint8Array): number;
|
360 | |
361 |
|
362 |
|
363 |
|
364 |
|
365 |
|
366 |
|
367 |
|
368 | static alloc(size: number, fill?: string | Buffer | number, encoding?: BufferEncoding): Buffer;
|
369 | |
370 |
|
371 |
|
372 |
|
373 |
|
374 |
|
375 | static allocUnsafe(size: number): Buffer;
|
376 | |
377 |
|
378 |
|
379 |
|
380 |
|
381 |
|
382 | static allocUnsafeSlow(size: number): Buffer;
|
383 | |
384 |
|
385 |
|
386 | static poolSize: number;
|
387 |
|
388 | write(string: string, encoding?: BufferEncoding): number;
|
389 | write(string: string, offset: number, encoding?: BufferEncoding): number;
|
390 | write(string: string, offset: number, length: number, encoding?: BufferEncoding): number;
|
391 | toString(encoding?: string, start?: number, end?: number): string;
|
392 | toJSON(): { type: 'Buffer'; data: number[] };
|
393 | equals(otherBuffer: Uint8Array): boolean;
|
394 | compare(
|
395 | otherBuffer: Uint8Array,
|
396 | targetStart?: number,
|
397 | targetEnd?: number,
|
398 | sourceStart?: number,
|
399 | sourceEnd?: number
|
400 | ): number;
|
401 | copy(targetBuffer: Uint8Array, targetStart?: number, sourceStart?: number, sourceEnd?: number): number;
|
402 | |
403 |
|
404 |
|
405 |
|
406 |
|
407 |
|
408 |
|
409 |
|
410 | slice(begin?: number, end?: number): Buffer;
|
411 | |
412 |
|
413 |
|
414 |
|
415 |
|
416 |
|
417 |
|
418 |
|
419 | subarray(begin?: number, end?: number): Buffer;
|
420 | writeUIntLE(value: number, offset: number, byteLength: number): number;
|
421 | writeUIntBE(value: number, offset: number, byteLength: number): number;
|
422 | writeIntLE(value: number, offset: number, byteLength: number): number;
|
423 | writeIntBE(value: number, offset: number, byteLength: number): number;
|
424 | readUIntLE(offset: number, byteLength: number): number;
|
425 | readUIntBE(offset: number, byteLength: number): number;
|
426 | readIntLE(offset: number, byteLength: number): number;
|
427 | readIntBE(offset: number, byteLength: number): number;
|
428 | readUInt8(offset: number): number;
|
429 | readUInt16LE(offset: number): number;
|
430 | readUInt16BE(offset: number): number;
|
431 | readUInt32LE(offset: number): number;
|
432 | readUInt32BE(offset: number): number;
|
433 | readInt8(offset: number): number;
|
434 | readInt16LE(offset: number): number;
|
435 | readInt16BE(offset: number): number;
|
436 | readInt32LE(offset: number): number;
|
437 | readInt32BE(offset: number): number;
|
438 | readFloatLE(offset: number): number;
|
439 | readFloatBE(offset: number): number;
|
440 | readDoubleLE(offset: number): number;
|
441 | readDoubleBE(offset: number): number;
|
442 | reverse(): this;
|
443 | swap16(): Buffer;
|
444 | swap32(): Buffer;
|
445 | swap64(): Buffer;
|
446 | writeUInt8(value: number, offset: number): number;
|
447 | writeUInt16LE(value: number, offset: number): number;
|
448 | writeUInt16BE(value: number, offset: number): number;
|
449 | writeUInt32LE(value: number, offset: number): number;
|
450 | writeUInt32BE(value: number, offset: number): number;
|
451 | writeInt8(value: number, offset: number): number;
|
452 | writeInt16LE(value: number, offset: number): number;
|
453 | writeInt16BE(value: number, offset: number): number;
|
454 | writeInt32LE(value: number, offset: number): number;
|
455 | writeInt32BE(value: number, offset: number): number;
|
456 | writeFloatLE(value: number, offset: number): number;
|
457 | writeFloatBE(value: number, offset: number): number;
|
458 | writeDoubleLE(value: number, offset: number): number;
|
459 | writeDoubleBE(value: number, offset: number): number;
|
460 |
|
461 | fill(value: string | Uint8Array | number, offset?: number, end?: number, encoding?: BufferEncoding): this;
|
462 |
|
463 | indexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number;
|
464 | lastIndexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number;
|
465 | entries(): IterableIterator<[number, number]>;
|
466 | includes(value: string | number | Buffer, byteOffset?: number, encoding?: BufferEncoding): boolean;
|
467 | keys(): IterableIterator<number>;
|
468 | values(): IterableIterator<number>;
|
469 | }
|
470 |
|
471 |
|
472 |
|
473 |
|
474 |
|
475 |
|
476 | declare namespace NodeJS {
|
477 | interface InspectOptions {
|
478 | |
479 |
|
480 |
|
481 |
|
482 |
|
483 |
|
484 |
|
485 |
|
486 | getters?: 'get' | 'set' | boolean;
|
487 | showHidden?: boolean;
|
488 | |
489 |
|
490 |
|
491 | depth?: number | null;
|
492 | colors?: boolean;
|
493 | customInspect?: boolean;
|
494 | showProxy?: boolean;
|
495 | maxArrayLength?: number | null;
|
496 | breakLength?: number;
|
497 | |
498 |
|
499 |
|
500 |
|
501 |
|
502 |
|
503 |
|
504 |
|
505 |
|
506 |
|
507 | compact?: boolean | number;
|
508 | sorted?: boolean | ((a: string, b: string) => number);
|
509 | }
|
510 |
|
511 | interface ConsoleConstructorOptions {
|
512 | stdout: WritableStream;
|
513 | stderr?: WritableStream;
|
514 | ignoreErrors?: boolean;
|
515 | colorMode?: boolean | 'auto';
|
516 | inspectOptions?: InspectOptions;
|
517 | }
|
518 |
|
519 | interface ConsoleConstructor {
|
520 | prototype: Console;
|
521 | new(stdout: WritableStream, stderr?: WritableStream, ignoreErrors?: boolean): Console;
|
522 | new(options: ConsoleConstructorOptions): Console;
|
523 | }
|
524 |
|
525 | interface CallSite {
|
526 | /**
|
527 | * Value of "this"
|
528 | */
|
529 | getThis(): any;
|
530 |
|
531 | /**
|
532 | * Type of "this" as a string.
|
533 | * This is the name of the function stored in the constructor field of
|
534 | * "this", if available. Otherwise the object's [[Class]] internal
|
535 | * property.
|
536 | */
|
537 | getTypeName(): string | null;
|
538 |
|
539 | /**
|
540 | * Current function
|
541 | */
|
542 | getFunction(): Function | undefined;
|
543 |
|
544 | /**
|
545 | * Name of the current function, typically its name property.
|
546 | * If a name property is not available an attempt will be made to try
|
547 | * to infer a name from the function's context.
|
548 | */
|
549 | getFunctionName(): string | null;
|
550 |
|
551 | /**
|
552 | * Name of the property [of "this" or one of its prototypes] that holds
|
553 | * the current function
|
554 | */
|
555 | getMethodName(): string | null;
|
556 |
|
557 | /**
|
558 | * Name of the script [if this function was defined in a script]
|
559 | */
|
560 | getFileName(): string | null;
|
561 |
|
562 | /**
|
563 | * Current line number [if this function was defined in a script]
|
564 | */
|
565 | getLineNumber(): number | null;
|
566 |
|
567 | /**
|
568 | * Current column number [if this function was defined in a script]
|
569 | */
|
570 | getColumnNumber(): number | null;
|
571 |
|
572 | /**
|
573 | * A call site object representing the location where eval was called
|
574 | * [if this function was created using a call to eval]
|
575 | */
|
576 | getEvalOrigin(): string | undefined;
|
577 |
|
578 | /**
|
579 | * Is this a toplevel invocation, that is, is "this" the global object?
|
580 | */
|
581 | isToplevel(): boolean;
|
582 |
|
583 | /**
|
584 | * Does this call take place in code defined by a call to eval?
|
585 | */
|
586 | isEval(): boolean;
|
587 |
|
588 | /**
|
589 | * Is this call in native V8 code?
|
590 | */
|
591 | isNative(): boolean;
|
592 |
|
593 | /**
|
594 | * Is this a constructor call?
|
595 | */
|
596 | isConstructor(): boolean;
|
597 | }
|
598 |
|
599 | interface ErrnoException extends Error {
|
600 | errno?: number;
|
601 | code?: string;
|
602 | path?: string;
|
603 | syscall?: string;
|
604 | stack?: string;
|
605 | }
|
606 |
|
607 | class EventEmitter {
|
608 | addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
609 | on(event: string | symbol, listener: (...args: any[]) => void): this;
|
610 | once(event: string | symbol, listener: (...args: any[]) => void): this;
|
611 | removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
612 | off(event: string | symbol, listener: (...args: any[]) => void): this;
|
613 | removeAllListeners(event?: string | symbol): this;
|
614 | setMaxListeners(n: number): this;
|
615 | getMaxListeners(): number;
|
616 | listeners(event: string | symbol): Function[];
|
617 | rawListeners(event: string | symbol): Function[];
|
618 | emit(event: string | symbol, ...args: any[]): boolean;
|
619 | listenerCount(type: string | symbol): number;
|
620 | // Added in Node 6...
|
621 | prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
622 | prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
623 | eventNames(): Array<string | symbol>;
|
624 | }
|
625 |
|
626 | interface ReadableStream extends EventEmitter {
|
627 | readable: boolean;
|
628 | read(size?: number): string | Buffer;
|
629 | setEncoding(encoding: string): this;
|
630 | pause(): this;
|
631 | resume(): this;
|
632 | isPaused(): boolean;
|
633 | pipe<T extends WritableStream>(destination: T, options?: { end?: boolean; }): T;
|
634 | unpipe(destination?: WritableStream): this;
|
635 | unshift(chunk: string | Uint8Array, encoding?: BufferEncoding): void;
|
636 | wrap(oldStream: ReadableStream): this;
|
637 | [Symbol.asyncIterator](): AsyncIterableIterator<string | Buffer>;
|
638 | }
|
639 |
|
640 | interface WritableStream extends EventEmitter {
|
641 | writable: boolean;
|
642 | write(buffer: Uint8Array | string, cb?: (err?: Error | null) => void): boolean;
|
643 | write(str: string, encoding?: string, cb?: (err?: Error | null) => void): boolean;
|
644 | end(cb?: () => void): void;
|
645 | end(data: string | Uint8Array, cb?: () => void): void;
|
646 | end(str: string, encoding?: string, cb?: () => void): void;
|
647 | }
|
648 |
|
649 | interface ReadWriteStream extends ReadableStream, WritableStream { }
|
650 |
|
651 | interface Domain extends EventEmitter {
|
652 | run<T>(fn: (...args: any[]) => T, ...args: any[]): T;
|
653 | add(emitter: EventEmitter | Timer): void;
|
654 | remove(emitter: EventEmitter | Timer): void;
|
655 | bind<T extends Function>(cb: T): T;
|
656 | intercept<T extends Function>(cb: T): T;
|
657 |
|
658 | addListener(event: string, listener: (...args: any[]) => void): this;
|
659 | on(event: string, listener: (...args: any[]) => void): this;
|
660 | once(event: string, listener: (...args: any[]) => void): this;
|
661 | removeListener(event: string, listener: (...args: any[]) => void): this;
|
662 | removeAllListeners(event?: string): this;
|
663 | }
|
664 |
|
665 | interface MemoryUsage {
|
666 | rss: number;
|
667 | heapTotal: number;
|
668 | heapUsed: number;
|
669 | external: number;
|
670 | }
|
671 |
|
672 | interface CpuUsage {
|
673 | user: number;
|
674 | system: number;
|
675 | }
|
676 |
|
677 | interface ProcessRelease {
|
678 | name: string;
|
679 | sourceUrl?: string;
|
680 | headersUrl?: string;
|
681 | libUrl?: string;
|
682 | lts?: string;
|
683 | }
|
684 |
|
685 | interface ProcessVersions {
|
686 | http_parser: string;
|
687 | node: string;
|
688 | v8: string;
|
689 | ares: string;
|
690 | uv: string;
|
691 | zlib: string;
|
692 | modules: string;
|
693 | openssl: string;
|
694 | }
|
695 |
|
696 | type Platform = 'aix'
|
697 | | 'android'
|
698 | | 'darwin'
|
699 | | 'freebsd'
|
700 | | 'linux'
|
701 | | 'openbsd'
|
702 | | 'sunos'
|
703 | | 'win32'
|
704 | | 'cygwin'
|
705 | | 'netbsd';
|
706 |
|
707 | type Signals =
|
708 | "SIGABRT" | "SIGALRM" | "SIGBUS" | "SIGCHLD" | "SIGCONT" | "SIGFPE" | "SIGHUP" | "SIGILL" | "SIGINT" | "SIGIO" |
|
709 | "SIGIOT" | "SIGKILL" | "SIGPIPE" | "SIGPOLL" | "SIGPROF" | "SIGPWR" | "SIGQUIT" | "SIGSEGV" | "SIGSTKFLT" |
|
710 | "SIGSTOP" | "SIGSYS" | "SIGTERM" | "SIGTRAP" | "SIGTSTP" | "SIGTTIN" | "SIGTTOU" | "SIGUNUSED" | "SIGURG" |
|
711 | "SIGUSR1" | "SIGUSR2" | "SIGVTALRM" | "SIGWINCH" | "SIGXCPU" | "SIGXFSZ" | "SIGBREAK" | "SIGLOST" | "SIGINFO";
|
712 |
|
713 | type MultipleResolveType = 'resolve' | 'reject';
|
714 |
|
715 | type BeforeExitListener = (code: number) => void;
|
716 | type DisconnectListener = () => void;
|
717 | type ExitListener = (code: number) => void;
|
718 | type RejectionHandledListener = (promise: Promise<any>) => void;
|
719 | type UncaughtExceptionListener = (error: Error) => void;
|
720 | type UnhandledRejectionListener = (reason: {} | null | undefined, promise: Promise<any>) => void;
|
721 | type WarningListener = (warning: Error) => void;
|
722 | type MessageListener = (message: any, sendHandle: any) => void;
|
723 | type SignalsListener = (signal: Signals) => void;
|
724 | type NewListenerListener = (type: string | symbol, listener: (...args: any[]) => void) => void;
|
725 | type RemoveListenerListener = (type: string | symbol, listener: (...args: any[]) => void) => void;
|
726 | type MultipleResolveListener = (type: MultipleResolveType, promise: Promise<any>, value: any) => void;
|
727 |
|
728 | interface Socket extends ReadWriteStream {
|
729 | isTTY?: true;
|
730 | }
|
731 |
|
732 | interface ProcessEnv {
|
733 | [key: string]: string | undefined;
|
734 | }
|
735 |
|
736 | interface HRTime {
|
737 | (time?: [number, number]): [number, number];
|
738 | }
|
739 |
|
740 | interface ProcessReport {
|
741 | |
742 |
|
743 |
|
744 |
|
745 |
|
746 | directory: string;
|
747 |
|
748 | |
749 |
|
750 |
|
751 |
|
752 |
|
753 |
|
754 | filename: string;
|
755 |
|
756 | |
757 |
|
758 |
|
759 |
|
760 | getReport(err?: Error): string;
|
761 |
|
762 | |
763 |
|
764 |
|
765 |
|
766 |
|
767 | reportOnFatalError: boolean;
|
768 |
|
769 | |
770 |
|
771 |
|
772 |
|
773 |
|
774 | reportOnSignal: boolean;
|
775 |
|
776 | |
777 |
|
778 |
|
779 |
|
780 | reportOnUncaughtException: boolean;
|
781 |
|
782 | |
783 |
|
784 |
|
785 |
|
786 | signal: Signals;
|
787 |
|
788 | |
789 |
|
790 |
|
791 |
|
792 |
|
793 |
|
794 |
|
795 |
|
796 |
|
797 |
|
798 |
|
799 |
|
800 | writeReport(fileName?: string): string;
|
801 | writeReport(error?: Error): string;
|
802 | writeReport(fileName?: string, err?: Error): string;
|
803 | }
|
804 |
|
805 | interface ResourceUsage {
|
806 | fsRead: number;
|
807 | fsWrite: number;
|
808 | involuntaryContextSwitches: number;
|
809 | ipcReceived: number;
|
810 | ipcSent: number;
|
811 | majorPageFault: number;
|
812 | maxRSS: number;
|
813 | minorPageFault: number;
|
814 | sharedMemorySize: number;
|
815 | signalsCount: number;
|
816 | swappedOut: number;
|
817 | systemCPUTime: number;
|
818 | unsharedDataSize: number;
|
819 | unsharedStackSize: number;
|
820 | userCPUTime: number;
|
821 | voluntaryContextSwitches: number;
|
822 | }
|
823 |
|
824 | interface Process extends EventEmitter {
|
825 | |
826 |
|
827 |
|
828 | stdout: WriteStream;
|
829 | |
830 |
|
831 |
|
832 | stderr: WriteStream;
|
833 | stdin: ReadStream;
|
834 | openStdin(): Socket;
|
835 | argv: string[];
|
836 | argv0: string;
|
837 | execArgv: string[];
|
838 | execPath: string;
|
839 | abort(): void;
|
840 | chdir(directory: string): void;
|
841 | cwd(): string;
|
842 | debugPort: number;
|
843 | emitWarning(warning: string | Error, name?: string, ctor?: Function): void;
|
844 | env: ProcessEnv;
|
845 | exit(code?: number): never;
|
846 | exitCode?: number;
|
847 | getgid(): number;
|
848 | setgid(id: number | string): void;
|
849 | getuid(): number;
|
850 | setuid(id: number | string): void;
|
851 | geteuid(): number;
|
852 | seteuid(id: number | string): void;
|
853 | getegid(): number;
|
854 | setegid(id: number | string): void;
|
855 | getgroups(): number[];
|
856 | setgroups(groups: Array<string | number>): void;
|
857 | setUncaughtExceptionCaptureCallback(cb: ((err: Error) => void) | null): void;
|
858 | hasUncaughtExceptionCaptureCallback(): boolean;
|
859 | version: string;
|
860 | versions: ProcessVersions;
|
861 | config: {
|
862 | target_defaults: {
|
863 | cflags: any[];
|
864 | default_configuration: string;
|
865 | defines: string[];
|
866 | include_dirs: string[];
|
867 | libraries: string[];
|
868 | };
|
869 | variables: {
|
870 | clang: number;
|
871 | host_arch: string;
|
872 | node_install_npm: boolean;
|
873 | node_install_waf: boolean;
|
874 | node_prefix: string;
|
875 | node_shared_openssl: boolean;
|
876 | node_shared_v8: boolean;
|
877 | node_shared_zlib: boolean;
|
878 | node_use_dtrace: boolean;
|
879 | node_use_etw: boolean;
|
880 | node_use_openssl: boolean;
|
881 | target_arch: string;
|
882 | v8_no_strict_aliasing: number;
|
883 | v8_use_snapshot: boolean;
|
884 | visibility: string;
|
885 | };
|
886 | };
|
887 | kill(pid: number, signal?: string | number): void;
|
888 | pid: number;
|
889 | ppid: number;
|
890 | title: string;
|
891 | arch: string;
|
892 | platform: Platform;
|
893 | mainModule?: NodeModule;
|
894 | memoryUsage(): MemoryUsage;
|
895 | cpuUsage(previousValue?: CpuUsage): CpuUsage;
|
896 | nextTick(callback: Function, ...args: any[]): void;
|
897 | release: ProcessRelease;
|
898 | features: {
|
899 | inspector: boolean;
|
900 | debug: boolean;
|
901 | uv: boolean;
|
902 | ipv6: boolean;
|
903 | tls_alpn: boolean;
|
904 | tls_sni: boolean;
|
905 | tls_ocsp: boolean;
|
906 | tls: boolean;
|
907 | };
|
908 | /**
|
909 | * Can only be set if not in worker thread.
|
910 | */
|
911 | umask(mask?: number): number;
|
912 | uptime(): number;
|
913 | hrtime: HRTime;
|
914 | domain: Domain;
|
915 |
|
916 | // Worker
|
917 | send?(message: any, sendHandle?: any, options?: { swallowErrors?: boolean}, callback?: (error: Error | null) => void): boolean;
|
918 | disconnect(): void;
|
919 | connected: boolean;
|
920 |
|
921 | /**
|
922 | * The `process.allowedNodeEnvironmentFlags` property is a special,
|
923 | * read-only `Set` of flags allowable within the [`NODE_OPTIONS`][]
|
924 | * environment variable.
|
925 | */
|
926 | allowedNodeEnvironmentFlags: ReadonlySet<string>;
|
927 |
|
928 | /**
|
929 | * Only available with `--experimental-report`
|
930 | */
|
931 | report?: ProcessReport;
|
932 |
|
933 | resourceUsage(): ResourceUsage;
|
934 |
|
935 | /**
|
936 | * EventEmitter
|
937 | * 1. beforeExit
|
938 | * 2. disconnect
|
939 | * 3. exit
|
940 | * 4. message
|
941 | * 5. rejectionHandled
|
942 | * 6. uncaughtException
|
943 | * 7. unhandledRejection
|
944 | * 8. warning
|
945 | * 9. message
|
946 | * 10. <All OS Signals>
|
947 | * 11. newListener/removeListener inherited from EventEmitter
|
948 | */
|
949 | addListener(event: "beforeExit", listener: BeforeExitListener): this;
|
950 | addListener(event: "disconnect", listener: DisconnectListener): this;
|
951 | addListener(event: "exit", listener: ExitListener): this;
|
952 | addListener(event: "rejectionHandled", listener: RejectionHandledListener): this;
|
953 | addListener(event: "uncaughtException", listener: UncaughtExceptionListener): this;
|
954 | addListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
|
955 | addListener(event: "warning", listener: WarningListener): this;
|
956 | addListener(event: "message", listener: MessageListener): this;
|
957 | addListener(event: Signals, listener: SignalsListener): this;
|
958 | addListener(event: "newListener", listener: NewListenerListener): this;
|
959 | addListener(event: "removeListener", listener: RemoveListenerListener): this;
|
960 | addListener(event: "multipleResolves", listener: MultipleResolveListener): this;
|
961 |
|
962 | emit(event: "beforeExit", code: number): boolean;
|
963 | emit(event: "disconnect"): boolean;
|
964 | emit(event: "exit", code: number): boolean;
|
965 | emit(event: "rejectionHandled", promise: Promise<any>): boolean;
|
966 | emit(event: "uncaughtException", error: Error): boolean;
|
967 | emit(event: "unhandledRejection", reason: any, promise: Promise<any>): boolean;
|
968 | emit(event: "warning", warning: Error): boolean;
|
969 | emit(event: "message", message: any, sendHandle: any): this;
|
970 | emit(event: Signals, signal: Signals): boolean;
|
971 | emit(event: "newListener", eventName: string | symbol, listener: (...args: any[]) => void): this;
|
972 | emit(event: "removeListener", eventName: string, listener: (...args: any[]) => void): this;
|
973 | emit(event: "multipleResolves", listener: MultipleResolveListener): this;
|
974 |
|
975 | on(event: "beforeExit", listener: BeforeExitListener): this;
|
976 | on(event: "disconnect", listener: DisconnectListener): this;
|
977 | on(event: "exit", listener: ExitListener): this;
|
978 | on(event: "rejectionHandled", listener: RejectionHandledListener): this;
|
979 | on(event: "uncaughtException", listener: UncaughtExceptionListener): this;
|
980 | on(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
|
981 | on(event: "warning", listener: WarningListener): this;
|
982 | on(event: "message", listener: MessageListener): this;
|
983 | on(event: Signals, listener: SignalsListener): this;
|
984 | on(event: "newListener", listener: NewListenerListener): this;
|
985 | on(event: "removeListener", listener: RemoveListenerListener): this;
|
986 | on(event: "multipleResolves", listener: MultipleResolveListener): this;
|
987 |
|
988 | once(event: "beforeExit", listener: BeforeExitListener): this;
|
989 | once(event: "disconnect", listener: DisconnectListener): this;
|
990 | once(event: "exit", listener: ExitListener): this;
|
991 | once(event: "rejectionHandled", listener: RejectionHandledListener): this;
|
992 | once(event: "uncaughtException", listener: UncaughtExceptionListener): this;
|
993 | once(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
|
994 | once(event: "warning", listener: WarningListener): this;
|
995 | once(event: "message", listener: MessageListener): this;
|
996 | once(event: Signals, listener: SignalsListener): this;
|
997 | once(event: "newListener", listener: NewListenerListener): this;
|
998 | once(event: "removeListener", listener: RemoveListenerListener): this;
|
999 | once(event: "multipleResolves", listener: MultipleResolveListener): this;
|
1000 |
|
1001 | prependListener(event: "beforeExit", listener: BeforeExitListener): this;
|
1002 | prependListener(event: "disconnect", listener: DisconnectListener): this;
|
1003 | prependListener(event: "exit", listener: ExitListener): this;
|
1004 | prependListener(event: "rejectionHandled", listener: RejectionHandledListener): this;
|
1005 | prependListener(event: "uncaughtException", listener: UncaughtExceptionListener): this;
|
1006 | prependListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
|
1007 | prependListener(event: "warning", listener: WarningListener): this;
|
1008 | prependListener(event: "message", listener: MessageListener): this;
|
1009 | prependListener(event: Signals, listener: SignalsListener): this;
|
1010 | prependListener(event: "newListener", listener: NewListenerListener): this;
|
1011 | prependListener(event: "removeListener", listener: RemoveListenerListener): this;
|
1012 | prependListener(event: "multipleResolves", listener: MultipleResolveListener): this;
|
1013 |
|
1014 | prependOnceListener(event: "beforeExit", listener: BeforeExitListener): this;
|
1015 | prependOnceListener(event: "disconnect", listener: DisconnectListener): this;
|
1016 | prependOnceListener(event: "exit", listener: ExitListener): this;
|
1017 | prependOnceListener(event: "rejectionHandled", listener: RejectionHandledListener): this;
|
1018 | prependOnceListener(event: "uncaughtException", listener: UncaughtExceptionListener): this;
|
1019 | prependOnceListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this;
|
1020 | prependOnceListener(event: "warning", listener: WarningListener): this;
|
1021 | prependOnceListener(event: "message", listener: MessageListener): this;
|
1022 | prependOnceListener(event: Signals, listener: SignalsListener): this;
|
1023 | prependOnceListener(event: "newListener", listener: NewListenerListener): this;
|
1024 | prependOnceListener(event: "removeListener", listener: RemoveListenerListener): this;
|
1025 | prependOnceListener(event: "multipleResolves", listener: MultipleResolveListener): this;
|
1026 |
|
1027 | listeners(event: "beforeExit"): BeforeExitListener[];
|
1028 | listeners(event: "disconnect"): DisconnectListener[];
|
1029 | listeners(event: "exit"): ExitListener[];
|
1030 | listeners(event: "rejectionHandled"): RejectionHandledListener[];
|
1031 | listeners(event: "uncaughtException"): UncaughtExceptionListener[];
|
1032 | listeners(event: "unhandledRejection"): UnhandledRejectionListener[];
|
1033 | listeners(event: "warning"): WarningListener[];
|
1034 | listeners(event: "message"): MessageListener[];
|
1035 | listeners(event: Signals): SignalsListener[];
|
1036 | listeners(event: "newListener"): NewListenerListener[];
|
1037 | listeners(event: "removeListener"): RemoveListenerListener[];
|
1038 | listeners(event: "multipleResolves"): MultipleResolveListener[];
|
1039 | }
|
1040 |
|
1041 | interface Global {
|
1042 | Array: typeof Array;
|
1043 | ArrayBuffer: typeof ArrayBuffer;
|
1044 | Boolean: typeof Boolean;
|
1045 | Buffer: typeof Buffer;
|
1046 | DataView: typeof DataView;
|
1047 | Date: typeof Date;
|
1048 | Error: typeof Error;
|
1049 | EvalError: typeof EvalError;
|
1050 | Float32Array: typeof Float32Array;
|
1051 | Float64Array: typeof Float64Array;
|
1052 | Function: typeof Function;
|
1053 | GLOBAL: Global;
|
1054 | Infinity: typeof Infinity;
|
1055 | Int16Array: typeof Int16Array;
|
1056 | Int32Array: typeof Int32Array;
|
1057 | Int8Array: typeof Int8Array;
|
1058 | Intl: typeof Intl;
|
1059 | JSON: typeof JSON;
|
1060 | Map: MapConstructor;
|
1061 | Math: typeof Math;
|
1062 | NaN: typeof NaN;
|
1063 | Number: typeof Number;
|
1064 | Object: typeof Object;
|
1065 | Promise: Function;
|
1066 | RangeError: typeof RangeError;
|
1067 | ReferenceError: typeof ReferenceError;
|
1068 | RegExp: typeof RegExp;
|
1069 | Set: SetConstructor;
|
1070 | String: typeof String;
|
1071 | Symbol: Function;
|
1072 | SyntaxError: typeof SyntaxError;
|
1073 | TypeError: typeof TypeError;
|
1074 | URIError: typeof URIError;
|
1075 | Uint16Array: typeof Uint16Array;
|
1076 | Uint32Array: typeof Uint32Array;
|
1077 | Uint8Array: typeof Uint8Array;
|
1078 | Uint8ClampedArray: Function;
|
1079 | WeakMap: WeakMapConstructor;
|
1080 | WeakSet: WeakSetConstructor;
|
1081 | clearImmediate: (immediateId: Immediate) => void;
|
1082 | clearInterval: (intervalId: Timeout) => void;
|
1083 | clearTimeout: (timeoutId: Timeout) => void;
|
1084 | console: typeof console;
|
1085 | decodeURI: typeof decodeURI;
|
1086 | decodeURIComponent: typeof decodeURIComponent;
|
1087 | encodeURI: typeof encodeURI;
|
1088 | encodeURIComponent: typeof encodeURIComponent;
|
1089 | escape: (str: string) => string;
|
1090 | eval: typeof eval;
|
1091 | global: Global;
|
1092 | isFinite: typeof isFinite;
|
1093 | isNaN: typeof isNaN;
|
1094 | parseFloat: typeof parseFloat;
|
1095 | parseInt: typeof parseInt;
|
1096 | process: Process;
|
1097 | root: Global;
|
1098 | setImmediate: (callback: (...args: any[]) => void, ...args: any[]) => Immediate;
|
1099 | setInterval: (callback: (...args: any[]) => void, ms: number, ...args: any[]) => Timeout;
|
1100 | setTimeout: (callback: (...args: any[]) => void, ms: number, ...args: any[]) => Timeout;
|
1101 | queueMicrotask: typeof queueMicrotask;
|
1102 | undefined: typeof undefined;
|
1103 | unescape: (str: string) => string;
|
1104 | gc: () => void;
|
1105 | v8debug?: any;
|
1106 | }
|
1107 |
|
1108 |
|
1109 | interface Timer {
|
1110 | hasRef(): boolean;
|
1111 | ref(): this;
|
1112 | refresh(): this;
|
1113 | unref(): this;
|
1114 | }
|
1115 |
|
1116 | class Immediate {
|
1117 | hasRef(): boolean;
|
1118 | ref(): this;
|
1119 | unref(): this;
|
1120 | _onImmediate: Function;
|
1121 | }
|
1122 |
|
1123 | class Timeout implements Timer {
|
1124 | hasRef(): boolean;
|
1125 | ref(): this;
|
1126 | refresh(): this;
|
1127 | unref(): this;
|
1128 | }
|
1129 |
|
1130 | class Module {
|
1131 | static runMain(): void;
|
1132 | static wrap(code: string): string;
|
1133 |
|
1134 | |
1135 |
|
1136 |
|
1137 | static createRequireFromPath(path: string): NodeRequireFunction;
|
1138 | static createRequire(path: string): NodeRequireFunction;
|
1139 | static builtinModules: string[];
|
1140 |
|
1141 | static Module: typeof Module;
|
1142 |
|
1143 | exports: any;
|
1144 | require: NodeRequireFunction;
|
1145 | id: string;
|
1146 | filename: string;
|
1147 | loaded: boolean;
|
1148 | parent: Module | null;
|
1149 | children: Module[];
|
1150 | paths: string[];
|
1151 |
|
1152 | constructor(id: string, parent?: Module);
|
1153 | }
|
1154 |
|
1155 | type TypedArray = Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array | Int8Array | Int16Array | Int32Array | Float32Array | Float64Array;
|
1156 | type ArrayBufferView = TypedArray | DataView;
|
1157 |
|
1158 | // The value type here is a "poor man's `unknown`". When these types support TypeScript
|
1159 | // 3.0+, we can replace this with `unknown`.
|
1160 | type PoorMansUnknown = {} | null | undefined;
|
1161 | }
|