@types/node 16.11.39 → 18.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {node v16.11 → node}/LICENSE +0 -0
- node v16.11/README.md → node/README.md +4 -4
- {node v16.11 → node}/assert/strict.d.ts +0 -0
- node v16.11/assert.d.ts → node/assert.d.ts +7 -8
- node v16.11/async_hooks.d.ts → node/async_hooks.d.ts +8 -4
- node/buffer.d.ts +2258 -0
- node v16.11/child_process.d.ts → node/child_process.d.ts +6 -3
- node v16.11/cluster.d.ts → node/cluster.d.ts +14 -18
- node v16.11/console.d.ts → node/console.d.ts +1 -1
- {node v16.11 → node}/constants.d.ts +0 -0
- node v16.11/crypto.d.ts → node/crypto.d.ts +679 -53
- node v16.11/dgram.d.ts → node/dgram.d.ts +3 -3
- node v16.11/diagnostics_channel.d.ts → node/diagnostics_channel.d.ts +2 -1
- node v16.11/dns/promises.d.ts → node/dns/promises.d.ts +10 -8
- node v16.11/dns.d.ts → node/dns.d.ts +16 -11
- node/dom-events.d.ts +126 -0
- node v16.11/domain.d.ts → node/domain.d.ts +3 -2
- node v16.11/events.d.ts → node/events.d.ts +65 -10
- node v16.11/fs/promises.d.ts → node/fs/promises.d.ts +86 -39
- node v16.11/fs.d.ts → node/fs.d.ts +149 -67
- node/globals.d.ts +300 -0
- {node v16.11 → node}/globals.global.d.ts +0 -0
- node v16.11/http.d.ts → node/http.d.ts +305 -77
- node v16.11/http2.d.ts → node/http2.d.ts +38 -5
- node v16.11/https.d.ts → node/https.d.ts +209 -59
- node v16.11/index.d.ts → node/index.d.ts +6 -3
- node v16.11/inspector.d.ts → node/inspector.d.ts +11 -15
- {node v16.11 → node}/module.d.ts +0 -0
- node v16.11/net.d.ts → node/net.d.ts +94 -21
- node v16.11/os.d.ts → node/os.d.ts +15 -4
- node v16.11/package.json → node/package.json +15 -8
- node v16.11/path.d.ts → node/path.d.ts +34 -23
- node v16.11/perf_hooks.d.ts → node/perf_hooks.d.ts +76 -8
- node v16.11/process.d.ts → node/process.d.ts +17 -16
- node v16.11/punycode.d.ts → node/punycode.d.ts +1 -1
- node v16.11/querystring.d.ts → node/querystring.d.ts +4 -4
- node/readline/promises.d.ts +143 -0
- node v16.11/readline.d.ts → node/readline.d.ts +140 -30
- node v16.11/repl.d.ts → node/repl.d.ts +2 -2
- node v16.11/stream/consumers.d.ts → node/stream/consumers.d.ts +2 -14
- {node v16.11 → node}/stream/promises.d.ts +0 -0
- node v16.11/stream/web.d.ts → node/stream/web.d.ts +3 -65
- node v16.11/stream.d.ts → node/stream.d.ts +97 -19
- node v16.11/string_decoder.d.ts → node/string_decoder.d.ts +1 -1
- node/test.d.ts +314 -0
- {node v16.11 → node}/timers/promises.d.ts +0 -0
- node v16.11/timers.d.ts → node/timers.d.ts +1 -1
- node v16.11/tls.d.ts → node/tls.d.ts +32 -23
- node v16.11/trace_events.d.ts → node/trace_events.d.ts +11 -1
- node/ts4.8/assert/strict.d.ts +8 -0
- node/ts4.8/assert.d.ts +911 -0
- node/ts4.8/async_hooks.d.ts +501 -0
- node v16.11/buffer.d.ts → node/ts4.8/buffer.d.ts +46 -19
- node/ts4.8/child_process.d.ts +1369 -0
- node/ts4.8/cluster.d.ts +410 -0
- node/ts4.8/console.d.ts +412 -0
- node/ts4.8/constants.d.ts +18 -0
- node/ts4.8/crypto.d.ts +3964 -0
- node/ts4.8/dgram.d.ts +545 -0
- node/ts4.8/diagnostics_channel.d.ts +153 -0
- node/ts4.8/dns/promises.d.ts +370 -0
- node/ts4.8/dns.d.ts +659 -0
- node/ts4.8/dom-events.d.ts +126 -0
- node/ts4.8/domain.d.ts +170 -0
- node/ts4.8/events.d.ts +678 -0
- node/ts4.8/fs/promises.d.ts +1138 -0
- node/ts4.8/fs.d.ts +3872 -0
- node v16.11/globals.d.ts → node/ts4.8/globals.d.ts +14 -4
- node/ts4.8/globals.global.d.ts +1 -0
- node/ts4.8/http.d.ts +1607 -0
- node/ts4.8/http2.d.ts +2134 -0
- node/ts4.8/https.d.ts +541 -0
- node/ts4.8/index.d.ts +88 -0
- node/ts4.8/inspector.d.ts +2741 -0
- node/ts4.8/module.d.ts +114 -0
- node/ts4.8/net.d.ts +869 -0
- node/ts4.8/os.d.ts +466 -0
- node/ts4.8/path.d.ts +191 -0
- node/ts4.8/perf_hooks.d.ts +625 -0
- node/ts4.8/process.d.ts +1482 -0
- node/ts4.8/punycode.d.ts +117 -0
- node/ts4.8/querystring.d.ts +131 -0
- node/ts4.8/readline/promises.d.ts +143 -0
- node/ts4.8/readline.d.ts +653 -0
- node/ts4.8/repl.d.ts +424 -0
- node/ts4.8/stream/consumers.d.ts +12 -0
- node/ts4.8/stream/promises.d.ts +42 -0
- node/ts4.8/stream/web.d.ts +330 -0
- node/ts4.8/stream.d.ts +1340 -0
- node/ts4.8/string_decoder.d.ts +67 -0
- node/ts4.8/test.d.ts +314 -0
- node/ts4.8/timers/promises.d.ts +68 -0
- node/ts4.8/timers.d.ts +94 -0
- node/ts4.8/tls.d.ts +1028 -0
- node/ts4.8/trace_events.d.ts +171 -0
- node v16.11/tty.d.ts → node/ts4.8/tty.d.ts +4 -2
- node v16.11/url.d.ts → node/ts4.8/url.d.ts +85 -39
- node v16.11/util.d.ts → node/ts4.8/util.d.ts +268 -12
- node v16.11/v8.d.ts → node/ts4.8/v8.d.ts +21 -3
- node v16.11/vm.d.ts → node/ts4.8/vm.d.ts +6 -4
- node v16.11/wasi.d.ts → node/ts4.8/wasi.d.ts +1 -1
- node v16.11/worker_threads.d.ts → node/ts4.8/worker_threads.d.ts +50 -10
- node v16.11/zlib.d.ts → node/ts4.8/zlib.d.ts +1 -1
- node/tty.d.ts +206 -0
- node/url.d.ts +897 -0
- node/util.d.ts +1850 -0
- node/v8.d.ts +396 -0
- node/vm.d.ts +509 -0
- node/wasi.d.ts +158 -0
- node/worker_threads.d.ts +689 -0
- node/zlib.d.ts +517 -0
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* ```js
|
|
11
11
|
* const net = require('net');
|
|
12
12
|
* ```
|
|
13
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
13
|
+
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/net.js)
|
|
14
14
|
*/
|
|
15
15
|
declare module 'net' {
|
|
16
16
|
import * as stream from 'node:stream';
|
|
@@ -54,6 +54,9 @@ declare module 'net' {
|
|
|
54
54
|
hints?: number | undefined;
|
|
55
55
|
family?: number | undefined;
|
|
56
56
|
lookup?: LookupFunction | undefined;
|
|
57
|
+
noDelay?: boolean | undefined;
|
|
58
|
+
keepAlive?: boolean | undefined;
|
|
59
|
+
keepAliveInitialDelay?: number | undefined;
|
|
57
60
|
}
|
|
58
61
|
interface IpcSocketConnectOpts extends ConnectOpts {
|
|
59
62
|
path: string;
|
|
@@ -128,6 +131,17 @@ declare module 'net' {
|
|
|
128
131
|
* @return The socket itself.
|
|
129
132
|
*/
|
|
130
133
|
pause(): this;
|
|
134
|
+
/**
|
|
135
|
+
* Close the TCP connection by sending an RST packet and destroy the stream.
|
|
136
|
+
* If this TCP socket is in connecting status, it will send an RST packet
|
|
137
|
+
* and destroy this TCP socket once it is connected. Otherwise, it will call
|
|
138
|
+
* `socket.destroy` with an `ERR_SOCKET_CLOSED` Error. If this is not a TCP socket
|
|
139
|
+
* (for example, a pipe), calling this method will immediately throw
|
|
140
|
+
* an `ERR_INVALID_HANDLE_TYPE` Error.
|
|
141
|
+
* @since v18.3.0
|
|
142
|
+
* @return The socket itself.
|
|
143
|
+
*/
|
|
144
|
+
resetAndDestroy(): this;
|
|
131
145
|
/**
|
|
132
146
|
* Resumes reading after a call to `socket.pause()`.
|
|
133
147
|
* @return The socket itself.
|
|
@@ -205,7 +219,7 @@ declare module 'net' {
|
|
|
205
219
|
*/
|
|
206
220
|
unref(): this;
|
|
207
221
|
/**
|
|
208
|
-
* Opposite of `unref()`, calling `ref()` on a previously `unref`ed socket
|
|
222
|
+
* Opposite of `unref()`, calling `ref()` on a previously `unref`ed socket will _not_ let the program exit if it's the only socket left (the default behavior).
|
|
209
223
|
* If the socket is `ref`ed calling `ref` again will have no effect.
|
|
210
224
|
* @since v0.9.1
|
|
211
225
|
* @return The socket itself.
|
|
@@ -263,6 +277,11 @@ declare module 'net' {
|
|
|
263
277
|
* @since v0.9.6
|
|
264
278
|
*/
|
|
265
279
|
readonly localPort?: number;
|
|
280
|
+
/**
|
|
281
|
+
* The string representation of the local IP family. `'IPv4'` or `'IPv6'`.
|
|
282
|
+
* @since v18.8.0
|
|
283
|
+
*/
|
|
284
|
+
readonly localFamily?: string;
|
|
266
285
|
/**
|
|
267
286
|
* This property represents the state of the connection as a string.
|
|
268
287
|
* @see {https://nodejs.org/api/net.html#socketreadystate}
|
|
@@ -312,7 +331,8 @@ declare module 'net' {
|
|
|
312
331
|
* 5. end
|
|
313
332
|
* 6. error
|
|
314
333
|
* 7. lookup
|
|
315
|
-
* 8.
|
|
334
|
+
* 8. ready
|
|
335
|
+
* 9. timeout
|
|
316
336
|
*/
|
|
317
337
|
addListener(event: string, listener: (...args: any[]) => void): this;
|
|
318
338
|
addListener(event: 'close', listener: (hadError: boolean) => void): this;
|
|
@@ -399,6 +419,33 @@ declare module 'net' {
|
|
|
399
419
|
* @default false
|
|
400
420
|
*/
|
|
401
421
|
pauseOnConnect?: boolean | undefined;
|
|
422
|
+
/**
|
|
423
|
+
* If set to `true`, it disables the use of Nagle's algorithm immediately after a new incoming connection is received.
|
|
424
|
+
* @default false
|
|
425
|
+
* @since v16.5.0
|
|
426
|
+
*/
|
|
427
|
+
noDelay?: boolean | undefined;
|
|
428
|
+
/**
|
|
429
|
+
* If set to `true`, it enables keep-alive functionality on the socket immediately after a new incoming connection is received,
|
|
430
|
+
* similarly on what is done in `socket.setKeepAlive([enable][, initialDelay])`.
|
|
431
|
+
* @default false
|
|
432
|
+
* @since v16.5.0
|
|
433
|
+
*/
|
|
434
|
+
keepAlive?: boolean | undefined;
|
|
435
|
+
/**
|
|
436
|
+
* If set to a positive number, it sets the initial delay before the first keepalive probe is sent on an idle socket.
|
|
437
|
+
* @default 0
|
|
438
|
+
* @since v16.5.0
|
|
439
|
+
*/
|
|
440
|
+
keepAliveInitialDelay?: number | undefined;
|
|
441
|
+
}
|
|
442
|
+
interface DropArgument {
|
|
443
|
+
localAddress?: string;
|
|
444
|
+
localPort?: number;
|
|
445
|
+
localFamily?: string;
|
|
446
|
+
remoteAddress?: string;
|
|
447
|
+
remotePort?: number;
|
|
448
|
+
remoteFamily?: string;
|
|
402
449
|
}
|
|
403
450
|
/**
|
|
404
451
|
* This class is used to create a TCP or `IPC` server.
|
|
@@ -504,7 +551,7 @@ declare module 'net' {
|
|
|
504
551
|
*/
|
|
505
552
|
getConnections(cb: (error: Error | null, count: number) => void): void;
|
|
506
553
|
/**
|
|
507
|
-
* Opposite of `unref()`, calling `ref()` on a previously `unref`ed server
|
|
554
|
+
* Opposite of `unref()`, calling `ref()` on a previously `unref`ed server will _not_ let the program exit if it's the only server left (the default behavior).
|
|
508
555
|
* If the server is `ref`ed calling `ref()` again will have no effect.
|
|
509
556
|
* @since v0.9.1
|
|
510
557
|
*/
|
|
@@ -536,49 +583,56 @@ declare module 'net' {
|
|
|
536
583
|
* 2. connection
|
|
537
584
|
* 3. error
|
|
538
585
|
* 4. listening
|
|
586
|
+
* 5. drop
|
|
539
587
|
*/
|
|
540
588
|
addListener(event: string, listener: (...args: any[]) => void): this;
|
|
541
589
|
addListener(event: 'close', listener: () => void): this;
|
|
542
590
|
addListener(event: 'connection', listener: (socket: Socket) => void): this;
|
|
543
591
|
addListener(event: 'error', listener: (err: Error) => void): this;
|
|
544
592
|
addListener(event: 'listening', listener: () => void): this;
|
|
593
|
+
addListener(event: 'drop', listener: (data?: DropArgument) => void): this;
|
|
545
594
|
emit(event: string | symbol, ...args: any[]): boolean;
|
|
546
595
|
emit(event: 'close'): boolean;
|
|
547
596
|
emit(event: 'connection', socket: Socket): boolean;
|
|
548
597
|
emit(event: 'error', err: Error): boolean;
|
|
549
598
|
emit(event: 'listening'): boolean;
|
|
599
|
+
emit(event: 'drop', data?: DropArgument): boolean;
|
|
550
600
|
on(event: string, listener: (...args: any[]) => void): this;
|
|
551
601
|
on(event: 'close', listener: () => void): this;
|
|
552
602
|
on(event: 'connection', listener: (socket: Socket) => void): this;
|
|
553
603
|
on(event: 'error', listener: (err: Error) => void): this;
|
|
554
604
|
on(event: 'listening', listener: () => void): this;
|
|
605
|
+
on(event: 'drop', listener: (data?: DropArgument) => void): this;
|
|
555
606
|
once(event: string, listener: (...args: any[]) => void): this;
|
|
556
607
|
once(event: 'close', listener: () => void): this;
|
|
557
608
|
once(event: 'connection', listener: (socket: Socket) => void): this;
|
|
558
609
|
once(event: 'error', listener: (err: Error) => void): this;
|
|
559
610
|
once(event: 'listening', listener: () => void): this;
|
|
611
|
+
once(event: 'drop', listener: (data?: DropArgument) => void): this;
|
|
560
612
|
prependListener(event: string, listener: (...args: any[]) => void): this;
|
|
561
613
|
prependListener(event: 'close', listener: () => void): this;
|
|
562
614
|
prependListener(event: 'connection', listener: (socket: Socket) => void): this;
|
|
563
615
|
prependListener(event: 'error', listener: (err: Error) => void): this;
|
|
564
616
|
prependListener(event: 'listening', listener: () => void): this;
|
|
617
|
+
prependListener(event: 'drop', listener: (data?: DropArgument) => void): this;
|
|
565
618
|
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
|
566
619
|
prependOnceListener(event: 'close', listener: () => void): this;
|
|
567
620
|
prependOnceListener(event: 'connection', listener: (socket: Socket) => void): this;
|
|
568
621
|
prependOnceListener(event: 'error', listener: (err: Error) => void): this;
|
|
569
622
|
prependOnceListener(event: 'listening', listener: () => void): this;
|
|
623
|
+
prependOnceListener(event: 'drop', listener: (data?: DropArgument) => void): this;
|
|
570
624
|
}
|
|
571
625
|
type IPVersion = 'ipv4' | 'ipv6';
|
|
572
626
|
/**
|
|
573
627
|
* The `BlockList` object can be used with some network APIs to specify rules for
|
|
574
628
|
* disabling inbound or outbound access to specific IP addresses, IP ranges, or
|
|
575
629
|
* IP subnets.
|
|
576
|
-
* @since v15.0.0
|
|
630
|
+
* @since v15.0.0, v14.18.0
|
|
577
631
|
*/
|
|
578
632
|
class BlockList {
|
|
579
633
|
/**
|
|
580
634
|
* Adds a rule to block the given IP address.
|
|
581
|
-
* @since v15.0.0
|
|
635
|
+
* @since v15.0.0, v14.18.0
|
|
582
636
|
* @param address An IPv4 or IPv6 address.
|
|
583
637
|
* @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`.
|
|
584
638
|
*/
|
|
@@ -586,7 +640,7 @@ declare module 'net' {
|
|
|
586
640
|
addAddress(address: SocketAddress): void;
|
|
587
641
|
/**
|
|
588
642
|
* Adds a rule to block a range of IP addresses from `start` (inclusive) to`end` (inclusive).
|
|
589
|
-
* @since v15.0.0
|
|
643
|
+
* @since v15.0.0, v14.18.0
|
|
590
644
|
* @param start The starting IPv4 or IPv6 address in the range.
|
|
591
645
|
* @param end The ending IPv4 or IPv6 address in the range.
|
|
592
646
|
* @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`.
|
|
@@ -595,7 +649,7 @@ declare module 'net' {
|
|
|
595
649
|
addRange(start: SocketAddress, end: SocketAddress): void;
|
|
596
650
|
/**
|
|
597
651
|
* Adds a rule to block a range of IP addresses specified as a subnet mask.
|
|
598
|
-
* @since v15.0.0
|
|
652
|
+
* @since v15.0.0, v14.18.0
|
|
599
653
|
* @param net The network IPv4 or IPv6 address.
|
|
600
654
|
* @param prefix The number of CIDR prefix bits. For IPv4, this must be a value between `0` and `32`. For IPv6, this must be between `0` and `128`.
|
|
601
655
|
* @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`.
|
|
@@ -619,7 +673,7 @@ declare module 'net' {
|
|
|
619
673
|
* console.log(blockList.check('::ffff:7b7b:7b7b', 'ipv6')); // Prints: true
|
|
620
674
|
* console.log(blockList.check('::ffff:123.123.123.123', 'ipv6')); // Prints: true
|
|
621
675
|
* ```
|
|
622
|
-
* @since v15.0.0
|
|
676
|
+
* @since v15.0.0, v14.18.0
|
|
623
677
|
* @param address The IP address to check
|
|
624
678
|
* @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`.
|
|
625
679
|
*/
|
|
@@ -650,7 +704,7 @@ declare module 'net' {
|
|
|
650
704
|
*
|
|
651
705
|
* The server can be a TCP server or an `IPC` server, depending on what it `listen()` to.
|
|
652
706
|
*
|
|
653
|
-
* Here is an example of
|
|
707
|
+
* Here is an example of a TCP echo server which listens for connections
|
|
654
708
|
* on port 8124:
|
|
655
709
|
*
|
|
656
710
|
* ```js
|
|
@@ -729,19 +783,39 @@ declare module 'net' {
|
|
|
729
783
|
function createConnection(port: number, host?: string, connectionListener?: () => void): Socket;
|
|
730
784
|
function createConnection(path: string, connectionListener?: () => void): Socket;
|
|
731
785
|
/**
|
|
732
|
-
*
|
|
733
|
-
*
|
|
734
|
-
*
|
|
786
|
+
* Returns `6` if `input` is an IPv6 address. Returns `4` if `input` is an IPv4
|
|
787
|
+
* address in [dot-decimal notation](https://en.wikipedia.org/wiki/Dot-decimal_notation) with no leading zeroes. Otherwise, returns`0`.
|
|
788
|
+
*
|
|
789
|
+
* ```js
|
|
790
|
+
* net.isIP('::1'); // returns 6
|
|
791
|
+
* net.isIP('127.0.0.1'); // returns 4
|
|
792
|
+
* net.isIP('127.000.000.001'); // returns 0
|
|
793
|
+
* net.isIP('127.0.0.1/24'); // returns 0
|
|
794
|
+
* net.isIP('fhqwhgads'); // returns 0
|
|
795
|
+
* ```
|
|
735
796
|
* @since v0.3.0
|
|
736
797
|
*/
|
|
737
798
|
function isIP(input: string): number;
|
|
738
799
|
/**
|
|
739
|
-
* Returns `true` if input is
|
|
800
|
+
* Returns `true` if `input` is an IPv4 address in [dot-decimal notation](https://en.wikipedia.org/wiki/Dot-decimal_notation) with no
|
|
801
|
+
* leading zeroes. Otherwise, returns `false`.
|
|
802
|
+
*
|
|
803
|
+
* ```js
|
|
804
|
+
* net.isIPv4('127.0.0.1'); // returns true
|
|
805
|
+
* net.isIPv4('127.000.000.001'); // returns false
|
|
806
|
+
* net.isIPv4('127.0.0.1/24'); // returns false
|
|
807
|
+
* net.isIPv4('fhqwhgads'); // returns false
|
|
808
|
+
* ```
|
|
740
809
|
* @since v0.3.0
|
|
741
810
|
*/
|
|
742
811
|
function isIPv4(input: string): boolean;
|
|
743
812
|
/**
|
|
744
|
-
* Returns `true` if input is
|
|
813
|
+
* Returns `true` if `input` is an IPv6 address. Otherwise, returns `false`.
|
|
814
|
+
*
|
|
815
|
+
* ```js
|
|
816
|
+
* net.isIPv6('::1'); // returns true
|
|
817
|
+
* net.isIPv6('fhqwhgads'); // returns false
|
|
818
|
+
* ```
|
|
745
819
|
* @since v0.3.0
|
|
746
820
|
*/
|
|
747
821
|
function isIPv6(input: string): boolean;
|
|
@@ -767,26 +841,25 @@ declare module 'net' {
|
|
|
767
841
|
port?: number | undefined;
|
|
768
842
|
}
|
|
769
843
|
/**
|
|
770
|
-
* @since v15.14.0
|
|
844
|
+
* @since v15.14.0, v14.18.0
|
|
771
845
|
*/
|
|
772
846
|
class SocketAddress {
|
|
773
847
|
constructor(options: SocketAddressInitOptions);
|
|
774
848
|
/**
|
|
775
|
-
*
|
|
776
|
-
* @since v15.14.0
|
|
849
|
+
* @since v15.14.0, v14.18.0
|
|
777
850
|
*/
|
|
778
851
|
readonly address: string;
|
|
779
852
|
/**
|
|
780
853
|
* Either \`'ipv4'\` or \`'ipv6'\`.
|
|
781
|
-
* @since v15.14.0
|
|
854
|
+
* @since v15.14.0, v14.18.0
|
|
782
855
|
*/
|
|
783
856
|
readonly family: IPVersion;
|
|
784
857
|
/**
|
|
785
|
-
* @since v15.14.0
|
|
858
|
+
* @since v15.14.0, v14.18.0
|
|
786
859
|
*/
|
|
787
860
|
readonly port: number;
|
|
788
861
|
/**
|
|
789
|
-
* @since v15.14.0
|
|
862
|
+
* @since v15.14.0, v14.18.0
|
|
790
863
|
*/
|
|
791
864
|
readonly flowlabel: number;
|
|
792
865
|
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* ```js
|
|
6
6
|
* const os = require('os');
|
|
7
7
|
* ```
|
|
8
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
8
|
+
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/os.js)
|
|
9
9
|
*/
|
|
10
10
|
declare module 'os' {
|
|
11
11
|
interface CpuInfo {
|
|
@@ -28,6 +28,7 @@ declare module 'os' {
|
|
|
28
28
|
}
|
|
29
29
|
interface NetworkInterfaceInfoIPv4 extends NetworkInterfaceBase {
|
|
30
30
|
family: 'IPv4';
|
|
31
|
+
scopeid?: undefined;
|
|
31
32
|
}
|
|
32
33
|
interface NetworkInterfaceInfoIPv6 extends NetworkInterfaceBase {
|
|
33
34
|
family: 'IPv6';
|
|
@@ -387,7 +388,7 @@ declare module 'os' {
|
|
|
387
388
|
const EOL: string;
|
|
388
389
|
/**
|
|
389
390
|
* Returns the operating system CPU architecture for which the Node.js binary was
|
|
390
|
-
* compiled. Possible values are `'arm'`, `'arm64'`, `'ia32'`, `'mips'`,`'mipsel'`, `'ppc'`, `'ppc64'`, `'s390'`, `'s390x'`,
|
|
391
|
+
* compiled. Possible values are `'arm'`, `'arm64'`, `'ia32'`, `'mips'`,`'mipsel'`, `'ppc'`, `'ppc64'`, `'s390'`, `'s390x'`, and `'x64'`.
|
|
391
392
|
*
|
|
392
393
|
* The return value is equivalent to `process.arch`.
|
|
393
394
|
* @since v0.5.0
|
|
@@ -402,8 +403,9 @@ declare module 'os' {
|
|
|
402
403
|
*/
|
|
403
404
|
function version(): string;
|
|
404
405
|
/**
|
|
405
|
-
* Returns a string identifying the operating system platform
|
|
406
|
-
*
|
|
406
|
+
* Returns a string identifying the operating system platform for which
|
|
407
|
+
* the Node.js binary was compiled. The value is set at compile time.
|
|
408
|
+
* Possible values are `'aix'`, `'darwin'`, `'freebsd'`,`'linux'`,`'openbsd'`, `'sunos'`, and `'win32'`.
|
|
407
409
|
*
|
|
408
410
|
* The return value is equivalent to `process.platform`.
|
|
409
411
|
*
|
|
@@ -412,6 +414,15 @@ declare module 'os' {
|
|
|
412
414
|
* @since v0.5.0
|
|
413
415
|
*/
|
|
414
416
|
function platform(): NodeJS.Platform;
|
|
417
|
+
/**
|
|
418
|
+
* Returns the machine type as a string, such as arm, aarch64, mips, mips64, ppc64, ppc64le, s390, s390x, i386, i686, x86_64.
|
|
419
|
+
*
|
|
420
|
+
* On POSIX systems, the machine type is determined by calling [`uname(3)`](https://linux.die.net/man/3/uname).
|
|
421
|
+
* On Windows, `RtlGetVersion()` is used, and if it is not available, `GetVersionExW()` will be used.
|
|
422
|
+
* See [https://en.wikipedia.org/wiki/Uname#Examples](https://en.wikipedia.org/wiki/Uname#Examples) for more information.
|
|
423
|
+
* @since v18.9.0
|
|
424
|
+
*/
|
|
425
|
+
function machine(): string;
|
|
415
426
|
/**
|
|
416
427
|
* Returns the operating system's default directory for temporary files as a
|
|
417
428
|
* string.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@types/node",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "18.11.2",
|
|
4
4
|
"description": "TypeScript definitions for Node.js",
|
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
|
|
6
6
|
"license": "MIT",
|
|
@@ -110,11 +110,6 @@
|
|
|
110
110
|
"url": "https://github.com/eps1lon",
|
|
111
111
|
"githubUsername": "eps1lon"
|
|
112
112
|
},
|
|
113
|
-
{
|
|
114
|
-
"name": "Seth Westphal",
|
|
115
|
-
"url": "https://github.com/westy92",
|
|
116
|
-
"githubUsername": "westy92"
|
|
117
|
-
},
|
|
118
113
|
{
|
|
119
114
|
"name": "Simon Schick",
|
|
120
115
|
"url": "https://github.com/SimonSchick",
|
|
@@ -209,10 +204,22 @@
|
|
|
209
204
|
"name": "wafuwafu13",
|
|
210
205
|
"url": "https://github.com/wafuwafu13",
|
|
211
206
|
"githubUsername": "wafuwafu13"
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
"name": "Matteo Collina",
|
|
210
|
+
"url": "https://github.com/mcollina",
|
|
211
|
+
"githubUsername": "mcollina"
|
|
212
212
|
}
|
|
213
213
|
],
|
|
214
214
|
"main": "",
|
|
215
215
|
"types": "index.d.ts",
|
|
216
|
+
"typesVersions": {
|
|
217
|
+
"<4.9.0-0": {
|
|
218
|
+
"*": [
|
|
219
|
+
"ts4.8/*"
|
|
220
|
+
]
|
|
221
|
+
}
|
|
222
|
+
},
|
|
216
223
|
"repository": {
|
|
217
224
|
"type": "git",
|
|
218
225
|
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
|
@@ -220,6 +227,6 @@
|
|
|
220
227
|
},
|
|
221
228
|
"scripts": {},
|
|
222
229
|
"dependencies": {},
|
|
223
|
-
"typesPublisherContentHash": "
|
|
224
|
-
"typeScriptVersion": "
|
|
230
|
+
"typesPublisherContentHash": "d7bbee366053005eb9ad76ecf711181a2633097e3afe20ba0ac3309f73d09afc",
|
|
231
|
+
"typeScriptVersion": "4.1"
|
|
225
232
|
}
|
|
@@ -13,7 +13,7 @@ declare module 'path/win32' {
|
|
|
13
13
|
* ```js
|
|
14
14
|
* const path = require('path');
|
|
15
15
|
* ```
|
|
16
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
16
|
+
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/path.js)
|
|
17
17
|
*/
|
|
18
18
|
declare module 'path' {
|
|
19
19
|
namespace path {
|
|
@@ -69,18 +69,19 @@ declare module 'path' {
|
|
|
69
69
|
* Normalize a string path, reducing '..' and '.' parts.
|
|
70
70
|
* When multiple slashes are found, they're replaced by a single one; when the path contains a trailing slash, it is preserved. On Windows backslashes are used.
|
|
71
71
|
*
|
|
72
|
-
* @param
|
|
72
|
+
* @param path string path to normalize.
|
|
73
|
+
* @throws {TypeError} if `path` is not a string.
|
|
73
74
|
*/
|
|
74
|
-
normalize(
|
|
75
|
+
normalize(path: string): string;
|
|
75
76
|
/**
|
|
76
77
|
* Join all arguments together and normalize the resulting path.
|
|
77
|
-
* Arguments must be strings. In v0.8, non-string arguments were silently ignored. In v0.10 and up, an exception is thrown.
|
|
78
78
|
*
|
|
79
79
|
* @param paths paths to join.
|
|
80
|
+
* @throws {TypeError} if any of the path segments is not a string.
|
|
80
81
|
*/
|
|
81
82
|
join(...paths: string[]): string;
|
|
82
83
|
/**
|
|
83
|
-
* The right-most parameter is considered {to}.
|
|
84
|
+
* The right-most parameter is considered {to}. Other parameters are considered an array of {from}.
|
|
84
85
|
*
|
|
85
86
|
* Starting from leftmost {from} parameter, resolves {to} to an absolute path.
|
|
86
87
|
*
|
|
@@ -89,61 +90,71 @@ declare module 'path' {
|
|
|
89
90
|
* the current working directory is used as well. The resulting path is normalized,
|
|
90
91
|
* and trailing slashes are removed unless the path gets resolved to the root directory.
|
|
91
92
|
*
|
|
92
|
-
* @param
|
|
93
|
+
* @param paths A sequence of paths or path segments.
|
|
94
|
+
* @throws {TypeError} if any of the arguments is not a string.
|
|
93
95
|
*/
|
|
94
|
-
resolve(...
|
|
96
|
+
resolve(...paths: string[]): string;
|
|
95
97
|
/**
|
|
96
98
|
* Determines whether {path} is an absolute path. An absolute path will always resolve to the same location, regardless of the working directory.
|
|
97
99
|
*
|
|
100
|
+
* If the given {path} is a zero-length string, `false` will be returned.
|
|
101
|
+
*
|
|
98
102
|
* @param path path to test.
|
|
103
|
+
* @throws {TypeError} if `path` is not a string.
|
|
99
104
|
*/
|
|
100
|
-
isAbsolute(
|
|
105
|
+
isAbsolute(path: string): boolean;
|
|
101
106
|
/**
|
|
102
|
-
* Solve the relative path from {from} to {to}.
|
|
107
|
+
* Solve the relative path from {from} to {to} based on the current working directory.
|
|
103
108
|
* At times we have two absolute paths, and we need to derive the relative path from one to the other. This is actually the reverse transform of path.resolve.
|
|
109
|
+
*
|
|
110
|
+
* @throws {TypeError} if either `from` or `to` is not a string.
|
|
104
111
|
*/
|
|
105
112
|
relative(from: string, to: string): string;
|
|
106
113
|
/**
|
|
107
114
|
* Return the directory name of a path. Similar to the Unix dirname command.
|
|
108
115
|
*
|
|
109
|
-
* @param
|
|
116
|
+
* @param path the path to evaluate.
|
|
117
|
+
* @throws {TypeError} if `path` is not a string.
|
|
110
118
|
*/
|
|
111
|
-
dirname(
|
|
119
|
+
dirname(path: string): string;
|
|
112
120
|
/**
|
|
113
121
|
* Return the last portion of a path. Similar to the Unix basename command.
|
|
114
122
|
* Often used to extract the file name from a fully qualified path.
|
|
115
123
|
*
|
|
116
|
-
* @param
|
|
117
|
-
* @param
|
|
124
|
+
* @param path the path to evaluate.
|
|
125
|
+
* @param suffix optionally, an extension to remove from the result.
|
|
126
|
+
* @throws {TypeError} if `path` is not a string or if `ext` is given and is not a string.
|
|
118
127
|
*/
|
|
119
|
-
basename(
|
|
128
|
+
basename(path: string, suffix?: string): string;
|
|
120
129
|
/**
|
|
121
130
|
* Return the extension of the path, from the last '.' to end of string in the last portion of the path.
|
|
122
|
-
* If there is no '.' in the last portion of the path or the first character of it is '.', then it returns an empty string
|
|
131
|
+
* If there is no '.' in the last portion of the path or the first character of it is '.', then it returns an empty string.
|
|
123
132
|
*
|
|
124
|
-
* @param
|
|
133
|
+
* @param path the path to evaluate.
|
|
134
|
+
* @throws {TypeError} if `path` is not a string.
|
|
125
135
|
*/
|
|
126
|
-
extname(
|
|
136
|
+
extname(path: string): string;
|
|
127
137
|
/**
|
|
128
138
|
* The platform-specific file separator. '\\' or '/'.
|
|
129
139
|
*/
|
|
130
|
-
readonly sep:
|
|
140
|
+
readonly sep: '\\' | '/';
|
|
131
141
|
/**
|
|
132
142
|
* The platform-specific file delimiter. ';' or ':'.
|
|
133
143
|
*/
|
|
134
|
-
readonly delimiter:
|
|
144
|
+
readonly delimiter: ';' | ':';
|
|
135
145
|
/**
|
|
136
146
|
* Returns an object from a path string - the opposite of format().
|
|
137
147
|
*
|
|
138
|
-
* @param
|
|
148
|
+
* @param path path to evaluate.
|
|
149
|
+
* @throws {TypeError} if `path` is not a string.
|
|
139
150
|
*/
|
|
140
|
-
parse(
|
|
151
|
+
parse(path: string): ParsedPath;
|
|
141
152
|
/**
|
|
142
153
|
* Returns a path string from an object - the opposite of parse().
|
|
143
154
|
*
|
|
144
|
-
* @param
|
|
155
|
+
* @param pathObject path to evaluate.
|
|
145
156
|
*/
|
|
146
|
-
format(
|
|
157
|
+
format(pathObject: FormatInputPathObject): string;
|
|
147
158
|
/**
|
|
148
159
|
* On Windows systems only, returns an equivalent namespace-prefixed path for the given path.
|
|
149
160
|
* If path is not a string, path will be returned without modifications.
|