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