@types/node 16.6.1 → 16.7.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/README.md +1 -1
- node/assert.d.ts +1 -1
- node/async_hooks.d.ts +1 -1
- node/buffer.d.ts +256 -37
- node/child_process.d.ts +2 -2
- node/cluster.d.ts +1 -1
- node/console.d.ts +1 -1
- node/crypto.d.ts +9 -9
- node/dgram.d.ts +1 -1
- node/diagnostics_channel.d.ts +1 -1
- node/dns.d.ts +5 -1
- node/domain.d.ts +1 -1
- node/events.d.ts +183 -4
- node/fs/promises.d.ts +33 -19
- node/fs.d.ts +118 -48
- node/http.d.ts +5 -5
- node/http2.d.ts +1 -1
- node/https.d.ts +1 -1
- node/index.d.ts +58 -11
- node/inspector.d.ts +1 -1
- node/net.d.ts +2 -2
- node/os.d.ts +1 -1
- node/package.json +3 -10
- node/path.d.ts +1 -1
- node/perf_hooks.d.ts +3 -3
- node/process.d.ts +2 -1
- node/punycode.d.ts +1 -1
- node/querystring.d.ts +2 -2
- node/readline.d.ts +1 -1
- node/repl.d.ts +1 -1
- node/stream/web.d.ts +0 -1
- node/stream.d.ts +2 -2
- node/string_decoder.d.ts +1 -1
- node/timers.d.ts +1 -1
- node/tls.d.ts +3 -3
- node/trace_events.d.ts +1 -1
- node/tty.d.ts +1 -1
- node/url.d.ts +37 -2
- node/util.d.ts +3 -3
- node/v8.d.ts +1 -1
- node/vm.d.ts +1 -1
- node/wasi.d.ts +1 -1
- node/worker_threads.d.ts +1 -1
- node/zlib.d.ts +1 -1
- node/base.d.ts +0 -19
- node/ts3.6/assert.d.ts +0 -103
- node/ts3.6/base.d.ts +0 -68
- node/ts3.6/index.d.ts +0 -7
node/fs.d.ts
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
*
|
|
17
17
|
* All file system operations have synchronous, callback, and promise-based
|
|
18
18
|
* forms, and are accessible using both CommonJS syntax and ES6 Modules (ESM).
|
|
19
|
-
* @see [source](https://github.com/nodejs/node/blob/v16.
|
|
19
|
+
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/fs.js)
|
|
20
20
|
*/
|
|
21
21
|
declare module 'fs' {
|
|
22
22
|
import * as stream from 'node:stream';
|
|
@@ -71,7 +71,7 @@ declare module 'fs' {
|
|
|
71
71
|
}
|
|
72
72
|
export interface Stats extends StatsBase<number> {}
|
|
73
73
|
/**
|
|
74
|
-
* A
|
|
74
|
+
* A `fs.Stats` object provides information about a file.
|
|
75
75
|
*
|
|
76
76
|
* Objects returned from {@link stat}, {@link lstat} and {@link fstat} and
|
|
77
77
|
* their synchronous counterparts are of this type.
|
|
@@ -133,53 +133,53 @@ declare module 'fs' {
|
|
|
133
133
|
export class Stats {}
|
|
134
134
|
/**
|
|
135
135
|
* A representation of a directory entry, which can be a file or a subdirectory
|
|
136
|
-
* within the directory, as returned by reading from an
|
|
136
|
+
* within the directory, as returned by reading from an `fs.Dir`. The
|
|
137
137
|
* directory entry is a combination of the file name and file type pairs.
|
|
138
138
|
*
|
|
139
139
|
* Additionally, when {@link readdir} or {@link readdirSync} is called with
|
|
140
|
-
* the `withFileTypes` option set to `true`, the resulting array is filled with
|
|
140
|
+
* the `withFileTypes` option set to `true`, the resulting array is filled with `fs.Dirent` objects, rather than strings or `Buffer` s.
|
|
141
141
|
* @since v10.10.0
|
|
142
142
|
*/
|
|
143
143
|
export class Dirent {
|
|
144
144
|
/**
|
|
145
|
-
* Returns `true` if the
|
|
145
|
+
* Returns `true` if the `fs.Dirent` object describes a regular file.
|
|
146
146
|
* @since v10.10.0
|
|
147
147
|
*/
|
|
148
148
|
isFile(): boolean;
|
|
149
149
|
/**
|
|
150
|
-
* Returns `true` if the
|
|
150
|
+
* Returns `true` if the `fs.Dirent` object describes a file system
|
|
151
151
|
* directory.
|
|
152
152
|
* @since v10.10.0
|
|
153
153
|
*/
|
|
154
154
|
isDirectory(): boolean;
|
|
155
155
|
/**
|
|
156
|
-
* Returns `true` if the
|
|
156
|
+
* Returns `true` if the `fs.Dirent` object describes a block device.
|
|
157
157
|
* @since v10.10.0
|
|
158
158
|
*/
|
|
159
159
|
isBlockDevice(): boolean;
|
|
160
160
|
/**
|
|
161
|
-
* Returns `true` if the
|
|
161
|
+
* Returns `true` if the `fs.Dirent` object describes a character device.
|
|
162
162
|
* @since v10.10.0
|
|
163
163
|
*/
|
|
164
164
|
isCharacterDevice(): boolean;
|
|
165
165
|
/**
|
|
166
|
-
* Returns `true` if the
|
|
166
|
+
* Returns `true` if the `fs.Dirent` object describes a symbolic link.
|
|
167
167
|
* @since v10.10.0
|
|
168
168
|
*/
|
|
169
169
|
isSymbolicLink(): boolean;
|
|
170
170
|
/**
|
|
171
|
-
* Returns `true` if the
|
|
171
|
+
* Returns `true` if the `fs.Dirent` object describes a first-in-first-out
|
|
172
172
|
* (FIFO) pipe.
|
|
173
173
|
* @since v10.10.0
|
|
174
174
|
*/
|
|
175
175
|
isFIFO(): boolean;
|
|
176
176
|
/**
|
|
177
|
-
* Returns `true` if the
|
|
177
|
+
* Returns `true` if the `fs.Dirent` object describes a socket.
|
|
178
178
|
* @since v10.10.0
|
|
179
179
|
*/
|
|
180
180
|
isSocket(): boolean;
|
|
181
181
|
/**
|
|
182
|
-
* The file name that this
|
|
182
|
+
* The file name that this `fs.Dirent` object refers to. The type of this
|
|
183
183
|
* value is determined by the `options.encoding` passed to {@link readdir} or {@link readdirSync}.
|
|
184
184
|
* @since v10.10.0
|
|
185
185
|
*/
|
|
@@ -202,7 +202,7 @@ declare module 'fs' {
|
|
|
202
202
|
* }
|
|
203
203
|
* ```
|
|
204
204
|
*
|
|
205
|
-
* When using the async iterator, the
|
|
205
|
+
* When using the async iterator, the `fs.Dir` object will be automatically
|
|
206
206
|
* closed after the iterator exits.
|
|
207
207
|
* @since v12.12.0
|
|
208
208
|
*/
|
|
@@ -233,9 +233,9 @@ declare module 'fs' {
|
|
|
233
233
|
*/
|
|
234
234
|
closeSync(): void;
|
|
235
235
|
/**
|
|
236
|
-
* Asynchronously read the next directory entry via [`readdir(3)`](http://man7.org/linux/man-pages/man3/readdir.3.html) as an
|
|
236
|
+
* Asynchronously read the next directory entry via [`readdir(3)`](http://man7.org/linux/man-pages/man3/readdir.3.html) as an `fs.Dirent`.
|
|
237
237
|
*
|
|
238
|
-
* A promise is returned that will be resolved with an
|
|
238
|
+
* A promise is returned that will be resolved with an `fs.Dirent`, or `null`if there are no more directory entries to read.
|
|
239
239
|
*
|
|
240
240
|
* Directory entries returned by this function are in no particular order as
|
|
241
241
|
* provided by the operating system's underlying directory mechanisms.
|
|
@@ -247,7 +247,7 @@ declare module 'fs' {
|
|
|
247
247
|
read(): Promise<Dirent | null>;
|
|
248
248
|
read(cb: (err: NodeJS.ErrnoException | null, dirEnt: Dirent | null) => void): void;
|
|
249
249
|
/**
|
|
250
|
-
* Synchronously read the next directory entry as an
|
|
250
|
+
* Synchronously read the next directory entry as an `fs.Dirent`. See the
|
|
251
251
|
* POSIX [`readdir(3)`](http://man7.org/linux/man-pages/man3/readdir.3.html) documentation for more detail.
|
|
252
252
|
*
|
|
253
253
|
* If there are no more directory entries to read, `null` will be returned.
|
|
@@ -262,7 +262,7 @@ declare module 'fs' {
|
|
|
262
262
|
}
|
|
263
263
|
export interface FSWatcher extends EventEmitter {
|
|
264
264
|
/**
|
|
265
|
-
* Stop watching for changes on the given
|
|
265
|
+
* Stop watching for changes on the given `fs.FSWatcher`. Once stopped, the `fs.FSWatcher` object is no longer usable.
|
|
266
266
|
* @since v0.5.8
|
|
267
267
|
*/
|
|
268
268
|
close(): void;
|
|
@@ -293,7 +293,7 @@ declare module 'fs' {
|
|
|
293
293
|
prependOnceListener(event: 'close', listener: () => void): this;
|
|
294
294
|
}
|
|
295
295
|
/**
|
|
296
|
-
* Instances of
|
|
296
|
+
* Instances of `fs.ReadStream` are created and returned using the {@link createReadStream} function.
|
|
297
297
|
* @since v0.1.93
|
|
298
298
|
*/
|
|
299
299
|
export class ReadStream extends stream.Readable {
|
|
@@ -305,8 +305,8 @@ declare module 'fs' {
|
|
|
305
305
|
bytesRead: number;
|
|
306
306
|
/**
|
|
307
307
|
* The path to the file the stream is reading from as specified in the first
|
|
308
|
-
* argument to `fs.createReadStream()`. If `path` is passed as a string, then`readStream.path` will be a string. If `path` is passed as a
|
|
309
|
-
*
|
|
308
|
+
* argument to `fs.createReadStream()`. If `path` is passed as a string, then`readStream.path` will be a string. If `path` is passed as a `Buffer`, then`readStream.path` will be a
|
|
309
|
+
* `Buffer`.
|
|
310
310
|
* @since v0.1.93
|
|
311
311
|
*/
|
|
312
312
|
path: string | Buffer;
|
|
@@ -374,9 +374,9 @@ declare module 'fs' {
|
|
|
374
374
|
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
375
375
|
}
|
|
376
376
|
/**
|
|
377
|
-
* * Extends
|
|
377
|
+
* * Extends `stream.Writable`
|
|
378
378
|
*
|
|
379
|
-
* Instances of
|
|
379
|
+
* Instances of `fs.WriteStream` are created and returned using the {@link createWriteStream} function.
|
|
380
380
|
* @since v0.1.93
|
|
381
381
|
*/
|
|
382
382
|
export class WriteStream extends stream.Writable {
|
|
@@ -394,8 +394,8 @@ declare module 'fs' {
|
|
|
394
394
|
bytesWritten: number;
|
|
395
395
|
/**
|
|
396
396
|
* The path to the file the stream is writing to as specified in the first
|
|
397
|
-
* argument to {@link createWriteStream}. If `path` is passed as a string, then`writeStream.path` will be a string. If `path` is passed as a
|
|
398
|
-
*
|
|
397
|
+
* argument to {@link createWriteStream}. If `path` is passed as a string, then`writeStream.path` will be a string. If `path` is passed as a `Buffer`, then`writeStream.path` will be a
|
|
398
|
+
* `Buffer`.
|
|
399
399
|
* @since v0.1.93
|
|
400
400
|
*/
|
|
401
401
|
path: string | Buffer;
|
|
@@ -499,6 +499,15 @@ declare module 'fs' {
|
|
|
499
499
|
* given to the completion callback. A file descriptor can also be passed as the
|
|
500
500
|
* first argument. In this case, `fs.ftruncate()` is called.
|
|
501
501
|
*
|
|
502
|
+
* ```js
|
|
503
|
+
* import { truncate } from 'fs';
|
|
504
|
+
* // Assuming that 'path/file.txt' is a regular file.
|
|
505
|
+
* truncate('path/file.txt', (err) => {
|
|
506
|
+
* if (err) throw err;
|
|
507
|
+
* console.log('path/file.txt was truncated');
|
|
508
|
+
* });
|
|
509
|
+
* ```
|
|
510
|
+
*
|
|
502
511
|
* Passing a file descriptor is deprecated and may result in an error being thrown
|
|
503
512
|
* in the future.
|
|
504
513
|
*
|
|
@@ -777,7 +786,7 @@ declare module 'fs' {
|
|
|
777
786
|
*/
|
|
778
787
|
export function lchmodSync(path: PathLike, mode: Mode): void;
|
|
779
788
|
/**
|
|
780
|
-
* Asynchronous [`stat(2)`](http://man7.org/linux/man-pages/man2/stat.2.html). The callback gets two arguments `(err, stats)` where`stats` is an
|
|
789
|
+
* Asynchronous [`stat(2)`](http://man7.org/linux/man-pages/man2/stat.2.html). The callback gets two arguments `(err, stats)` where`stats` is an `fs.Stats` object.
|
|
781
790
|
*
|
|
782
791
|
* In case of an error, the `err.code` will be one of `Common System Errors`.
|
|
783
792
|
*
|
|
@@ -938,7 +947,7 @@ declare module 'fs' {
|
|
|
938
947
|
*/
|
|
939
948
|
export const statSync: StatSyncFn;
|
|
940
949
|
/**
|
|
941
|
-
* Invokes the callback with the
|
|
950
|
+
* Invokes the callback with the `fs.Stats` for the file descriptor.
|
|
942
951
|
*
|
|
943
952
|
* See the POSIX [`fstat(2)`](http://man7.org/linux/man-pages/man2/fstat.2.html) documentation for more detail.
|
|
944
953
|
* @since v0.1.95
|
|
@@ -986,8 +995,8 @@ declare module 'fs' {
|
|
|
986
995
|
*/
|
|
987
996
|
export const fstatSync: StatSyncFn<number>;
|
|
988
997
|
/**
|
|
989
|
-
* Retrieves the
|
|
990
|
-
* The callback gets two arguments `(err, stats)` where `stats` is a
|
|
998
|
+
* Retrieves the `fs.Stats` for the symbolic link referred to by the path.
|
|
999
|
+
* The callback gets two arguments `(err, stats)` where `stats` is a `fs.Stats` object. `lstat()` is identical to `stat()`, except that if `path` is a symbolic
|
|
991
1000
|
* link, then the link itself is stat-ed, not the file that it refers to.
|
|
992
1001
|
*
|
|
993
1002
|
* See the POSIX [`lstat(2)`](http://man7.org/linux/man-pages/man2/lstat.2.html) documentation for more details.
|
|
@@ -1121,7 +1130,7 @@ declare module 'fs' {
|
|
|
1121
1130
|
* The optional `options` argument can be a string specifying an encoding, or an
|
|
1122
1131
|
* object with an `encoding` property specifying the character encoding to use for
|
|
1123
1132
|
* the link path passed to the callback. If the `encoding` is set to `'buffer'`,
|
|
1124
|
-
* the link path returned will be passed as a
|
|
1133
|
+
* the link path returned will be passed as a `Buffer` object.
|
|
1125
1134
|
* @since v0.1.31
|
|
1126
1135
|
*/
|
|
1127
1136
|
export function readlink(path: PathLike, options: EncodingOption, callback: (err: NodeJS.ErrnoException | null, linkString: string) => void): void;
|
|
@@ -1170,7 +1179,7 @@ declare module 'fs' {
|
|
|
1170
1179
|
* The optional `options` argument can be a string specifying an encoding, or an
|
|
1171
1180
|
* object with an `encoding` property specifying the character encoding to use for
|
|
1172
1181
|
* the link path returned. If the `encoding` is set to `'buffer'`,
|
|
1173
|
-
* the link path returned will be passed as a
|
|
1182
|
+
* the link path returned will be passed as a `Buffer` object.
|
|
1174
1183
|
* @since v0.1.31
|
|
1175
1184
|
*/
|
|
1176
1185
|
export function readlinkSync(path: PathLike, options?: EncodingOption): string;
|
|
@@ -1206,7 +1215,7 @@ declare module 'fs' {
|
|
|
1206
1215
|
* The optional `options` argument can be a string specifying an encoding, or an
|
|
1207
1216
|
* object with an `encoding` property specifying the character encoding to use for
|
|
1208
1217
|
* the path passed to the callback. If the `encoding` is set to `'buffer'`,
|
|
1209
|
-
* the path returned will be passed as a
|
|
1218
|
+
* the path returned will be passed as a `Buffer` object.
|
|
1210
1219
|
*
|
|
1211
1220
|
* If `path` resolves to a socket or a pipe, the function will return a system
|
|
1212
1221
|
* dependent name for that object.
|
|
@@ -1259,7 +1268,7 @@ declare module 'fs' {
|
|
|
1259
1268
|
* The optional `options` argument can be a string specifying an encoding, or an
|
|
1260
1269
|
* object with an `encoding` property specifying the character encoding to use for
|
|
1261
1270
|
* the path passed to the callback. If the `encoding` is set to `'buffer'`,
|
|
1262
|
-
* the path returned will be passed as a
|
|
1271
|
+
* the path returned will be passed as a `Buffer` object.
|
|
1263
1272
|
*
|
|
1264
1273
|
* On Linux, when Node.js is linked against musl libc, the procfs file system must
|
|
1265
1274
|
* be mounted on `/proc` in order for this function to work. Glibc does not have
|
|
@@ -1719,9 +1728,9 @@ declare module 'fs' {
|
|
|
1719
1728
|
* The optional `options` argument can be a string specifying an encoding, or an
|
|
1720
1729
|
* object with an `encoding` property specifying the character encoding to use for
|
|
1721
1730
|
* the filenames passed to the callback. If the `encoding` is set to `'buffer'`,
|
|
1722
|
-
* the filenames returned will be passed as
|
|
1731
|
+
* the filenames returned will be passed as `Buffer` objects.
|
|
1723
1732
|
*
|
|
1724
|
-
* If `options.withFileTypes` is set to `true`, the `files` array will contain
|
|
1733
|
+
* If `options.withFileTypes` is set to `true`, the `files` array will contain `fs.Dirent` objects.
|
|
1725
1734
|
* @since v0.1.8
|
|
1726
1735
|
*/
|
|
1727
1736
|
export function readdir(
|
|
@@ -1848,9 +1857,9 @@ declare module 'fs' {
|
|
|
1848
1857
|
* The optional `options` argument can be a string specifying an encoding, or an
|
|
1849
1858
|
* object with an `encoding` property specifying the character encoding to use for
|
|
1850
1859
|
* the filenames returned. If the `encoding` is set to `'buffer'`,
|
|
1851
|
-
* the filenames returned will be passed as
|
|
1860
|
+
* the filenames returned will be passed as `Buffer` objects.
|
|
1852
1861
|
*
|
|
1853
|
-
* If `options.withFileTypes` is set to `true`, the result will contain
|
|
1862
|
+
* If `options.withFileTypes` is set to `true`, the result will contain `fs.Dirent` objects.
|
|
1854
1863
|
* @since v0.1.21
|
|
1855
1864
|
*/
|
|
1856
1865
|
export function readdirSync(
|
|
@@ -2530,7 +2539,7 @@ declare module 'fs' {
|
|
|
2530
2539
|
* performs multiple `write` calls internally to write the buffer passed to it.
|
|
2531
2540
|
* For performance sensitive code consider using {@link createWriteStream}.
|
|
2532
2541
|
*
|
|
2533
|
-
* It is possible to use an
|
|
2542
|
+
* It is possible to use an `AbortSignal` to cancel an `fs.writeFile()`.
|
|
2534
2543
|
* Cancelation is "best effort", and some amount of data is likely still
|
|
2535
2544
|
* to be written.
|
|
2536
2545
|
*
|
|
@@ -2589,7 +2598,7 @@ declare module 'fs' {
|
|
|
2589
2598
|
export function writeFileSync(file: PathOrFileDescriptor, data: string | NodeJS.ArrayBufferView, options?: WriteFileOptions): void;
|
|
2590
2599
|
/**
|
|
2591
2600
|
* Asynchronously append data to a file, creating the file if it does not yet
|
|
2592
|
-
* exist. `data` can be a string or a
|
|
2601
|
+
* exist. `data` can be a string or a `Buffer`.
|
|
2593
2602
|
*
|
|
2594
2603
|
* ```js
|
|
2595
2604
|
* import { appendFile } from 'fs';
|
|
@@ -2663,7 +2672,7 @@ declare module 'fs' {
|
|
|
2663
2672
|
}
|
|
2664
2673
|
/**
|
|
2665
2674
|
* Synchronously append data to a file, creating the file if it does not yet
|
|
2666
|
-
* exist. `data` can be a string or a
|
|
2675
|
+
* exist. `data` can be a string or a `Buffer`.
|
|
2667
2676
|
*
|
|
2668
2677
|
* ```js
|
|
2669
2678
|
* import { appendFileSync } from 'fs';
|
|
@@ -2801,10 +2810,10 @@ declare module 'fs' {
|
|
|
2801
2810
|
* On most platforms, `'rename'` is emitted whenever a filename appears or
|
|
2802
2811
|
* disappears in the directory.
|
|
2803
2812
|
*
|
|
2804
|
-
* The listener callback is attached to the `'change'` event fired by
|
|
2813
|
+
* The listener callback is attached to the `'change'` event fired by `fs.FSWatcher`, but it is not the same thing as the `'change'` value of`eventType`.
|
|
2805
2814
|
*
|
|
2806
2815
|
* If a `signal` is passed, aborting the corresponding AbortController will close
|
|
2807
|
-
* the returned
|
|
2816
|
+
* the returned `fs.FSWatcher`.
|
|
2808
2817
|
* @since v0.5.10
|
|
2809
2818
|
* @param listener
|
|
2810
2819
|
*/
|
|
@@ -3338,11 +3347,11 @@ declare module 'fs' {
|
|
|
3338
3347
|
* start counting at 0, allowed values are in the
|
|
3339
3348
|
* \[0, [`Number.MAX_SAFE_INTEGER`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER)\] range. If `fd` is specified and `start` is
|
|
3340
3349
|
* omitted or `undefined`, `fs.createReadStream()` reads sequentially from the
|
|
3341
|
-
* current file position. The `encoding` can be any one of those accepted by
|
|
3350
|
+
* current file position. The `encoding` can be any one of those accepted by `Buffer`.
|
|
3342
3351
|
*
|
|
3343
3352
|
* If `fd` is specified, `ReadStream` will ignore the `path` argument and will use
|
|
3344
3353
|
* the specified file descriptor. This means that no `'open'` event will be
|
|
3345
|
-
* emitted. `fd` should be blocking; non-blocking `fd`s should be passed to
|
|
3354
|
+
* emitted. `fd` should be blocking; non-blocking `fd`s should be passed to `net.Socket`.
|
|
3346
3355
|
*
|
|
3347
3356
|
* If `fd` points to a character device that only supports blocking reads
|
|
3348
3357
|
* (such as keyboard or sound card), read operations do not finish until data is
|
|
@@ -3399,7 +3408,7 @@ declare module 'fs' {
|
|
|
3399
3408
|
* position past the beginning of the file, allowed values are in the
|
|
3400
3409
|
* \[0, [`Number.MAX_SAFE_INTEGER`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER)\] range. Modifying a file rather than replacing
|
|
3401
3410
|
* it may require the `flags` option to be set to `r+` rather than the default `w`.
|
|
3402
|
-
* The `encoding` can be any one of those accepted by
|
|
3411
|
+
* The `encoding` can be any one of those accepted by `Buffer`.
|
|
3403
3412
|
*
|
|
3404
3413
|
* If `autoClose` is set to true (default behavior) on `'error'` or `'finish'`the file descriptor will be closed automatically. If `autoClose` is false,
|
|
3405
3414
|
* then the file descriptor won't be closed, even if there's an error.
|
|
@@ -3413,9 +3422,9 @@ declare module 'fs' {
|
|
|
3413
3422
|
* performance as some optimizations (`_writev()`)
|
|
3414
3423
|
* will be disabled. When providing the `fs` option, overrides for `open`,`close`, and at least one of `write` and `writev` are required.
|
|
3415
3424
|
*
|
|
3416
|
-
* Like
|
|
3425
|
+
* Like `fs.ReadStream`, if `fd` is specified, `fs.WriteStream` will ignore the`path` argument and will use the specified file descriptor. This means that no`'open'` event will be
|
|
3417
3426
|
* emitted. `fd` should be blocking; non-blocking `fd`s
|
|
3418
|
-
* should be passed to
|
|
3427
|
+
* should be passed to `net.Socket`.
|
|
3419
3428
|
*
|
|
3420
3429
|
* If `options` is a string, then it specifies the encoding.
|
|
3421
3430
|
* @since v0.1.31
|
|
@@ -3610,7 +3619,7 @@ declare module 'fs' {
|
|
|
3610
3619
|
/**
|
|
3611
3620
|
* Synchronously open a directory. See [`opendir(3)`](http://man7.org/linux/man-pages/man3/opendir.3.html).
|
|
3612
3621
|
*
|
|
3613
|
-
* Creates an
|
|
3622
|
+
* Creates an `fs.Dir`, which contains all further functions for reading from
|
|
3614
3623
|
* and cleaning up the directory.
|
|
3615
3624
|
*
|
|
3616
3625
|
* The `encoding` option sets the encoding for the `path` while opening the
|
|
@@ -3622,7 +3631,7 @@ declare module 'fs' {
|
|
|
3622
3631
|
* Asynchronously open a directory. See the POSIX [`opendir(3)`](http://man7.org/linux/man-pages/man3/opendir.3.html) documentation for
|
|
3623
3632
|
* more details.
|
|
3624
3633
|
*
|
|
3625
|
-
* Creates an
|
|
3634
|
+
* Creates an `fs.Dir`, which contains all further functions for reading from
|
|
3626
3635
|
* and cleaning up the directory.
|
|
3627
3636
|
*
|
|
3628
3637
|
* The `encoding` option sets the encoding for the `path` while opening the
|
|
@@ -3647,6 +3656,67 @@ declare module 'fs' {
|
|
|
3647
3656
|
bigint?: boolean | undefined;
|
|
3648
3657
|
throwIfNoEntry?: boolean | undefined;
|
|
3649
3658
|
}
|
|
3659
|
+
export interface CopyOptions {
|
|
3660
|
+
/**
|
|
3661
|
+
* Dereference symlinks
|
|
3662
|
+
* @default false
|
|
3663
|
+
*/
|
|
3664
|
+
dereference?: boolean;
|
|
3665
|
+
/**
|
|
3666
|
+
* When `force` is `false`, and the destination
|
|
3667
|
+
* exists, throw an error.
|
|
3668
|
+
* @default false
|
|
3669
|
+
*/
|
|
3670
|
+
errorOnExist?: boolean;
|
|
3671
|
+
/**
|
|
3672
|
+
* Function to filter copied files/directories. Return
|
|
3673
|
+
* `true` to copy the item, `false` to ignore it.
|
|
3674
|
+
*/
|
|
3675
|
+
filter?(source: string, destination: string): boolean;
|
|
3676
|
+
/**
|
|
3677
|
+
* Overwrite existing file or directory. _The copy
|
|
3678
|
+
* operation will ignore errors if you set this to false and the destination
|
|
3679
|
+
* exists. Use the `errorOnExist` option to change this behavior.
|
|
3680
|
+
* @default true
|
|
3681
|
+
*/
|
|
3682
|
+
force?: boolean;
|
|
3683
|
+
/**
|
|
3684
|
+
* When `true` timestamps from `src` will
|
|
3685
|
+
* be preserved.
|
|
3686
|
+
* @default false
|
|
3687
|
+
*/
|
|
3688
|
+
preserveTimestamps?: boolean;
|
|
3689
|
+
/**
|
|
3690
|
+
* Copy directories recursively.
|
|
3691
|
+
* @default false
|
|
3692
|
+
*/
|
|
3693
|
+
recursive?: boolean;
|
|
3694
|
+
}
|
|
3695
|
+
/**
|
|
3696
|
+
* Asynchronously copies the entire directory structure from `src` to `dest`,
|
|
3697
|
+
* including subdirectories and files.
|
|
3698
|
+
*
|
|
3699
|
+
* When copying a directory to another directory, globs are not supported and
|
|
3700
|
+
* behavior is similar to `cp dir1/ dir2/`.
|
|
3701
|
+
* @since v16.7.0
|
|
3702
|
+
* @experimental
|
|
3703
|
+
* @param src source path to copy.
|
|
3704
|
+
* @param dest destination path to copy to.
|
|
3705
|
+
*/
|
|
3706
|
+
export function cp(source: string, destination: string, callback: (err: NodeJS.ErrnoException | null) => void): void;
|
|
3707
|
+
export function cp(source: string, destination: string, opts: CopyOptions, callback: (err: NodeJS.ErrnoException | null) => void): void;
|
|
3708
|
+
/**
|
|
3709
|
+
* Synchronously copies the entire directory structure from `src` to `dest`,
|
|
3710
|
+
* including subdirectories and files.
|
|
3711
|
+
*
|
|
3712
|
+
* When copying a directory to another directory, globs are not supported and
|
|
3713
|
+
* behavior is similar to `cp dir1/ dir2/`.
|
|
3714
|
+
* @since v16.7.0
|
|
3715
|
+
* @experimental
|
|
3716
|
+
* @param src source path to copy.
|
|
3717
|
+
* @param dest destination path to copy to.
|
|
3718
|
+
*/
|
|
3719
|
+
export function cpSync(source: string, destination: string, opts?: CopyOptions): void;
|
|
3650
3720
|
}
|
|
3651
3721
|
declare module 'node:fs' {
|
|
3652
3722
|
export * from 'fs';
|
node/http.d.ts
CHANGED
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
* 'Host', 'mysite.com',
|
|
38
38
|
* 'accepT', '*' ]
|
|
39
39
|
* ```
|
|
40
|
-
* @see [source](https://github.com/nodejs/node/blob/v16.
|
|
40
|
+
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/http.js)
|
|
41
41
|
*/
|
|
42
42
|
declare module 'http' {
|
|
43
43
|
import * as stream from 'node:stream';
|
|
@@ -740,7 +740,7 @@ declare module 'http' {
|
|
|
740
740
|
* access response
|
|
741
741
|
* status, headers and data.
|
|
742
742
|
*
|
|
743
|
-
* Different from its `socket` value which is a subclass of
|
|
743
|
+
* Different from its `socket` value which is a subclass of `stream.Duplex`, the`IncomingMessage` itself extends `stream.Readable` and is created separately to
|
|
744
744
|
* parse and emit the incoming HTTP headers and payload, as the underlying socket
|
|
745
745
|
* may be reused multiple times in case of keep-alive.
|
|
746
746
|
* @since v0.1.17
|
|
@@ -800,9 +800,9 @@ declare module 'http' {
|
|
|
800
800
|
* With HTTPS support, use `request.socket.getPeerCertificate()` to obtain the
|
|
801
801
|
* client's authentication details.
|
|
802
802
|
*
|
|
803
|
-
* This property is guaranteed to be an instance of the
|
|
804
|
-
* a subclass of
|
|
805
|
-
* type other than
|
|
803
|
+
* This property is guaranteed to be an instance of the `net.Socket` class,
|
|
804
|
+
* a subclass of `stream.Duplex`, unless the user specified a socket
|
|
805
|
+
* type other than `net.Socket`.
|
|
806
806
|
* @since v0.3.0
|
|
807
807
|
*/
|
|
808
808
|
socket: Socket;
|
node/http2.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* const http2 = require('http2');
|
|
7
7
|
* ```
|
|
8
8
|
* @since v8.4.0
|
|
9
|
-
* @see [source](https://github.com/nodejs/node/blob/v16.
|
|
9
|
+
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/http2.js)
|
|
10
10
|
*/
|
|
11
11
|
declare module 'http2' {
|
|
12
12
|
import EventEmitter = require('node:events');
|
node/https.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* HTTPS is the HTTP protocol over TLS/SSL. In Node.js this is implemented as a
|
|
3
3
|
* separate module.
|
|
4
|
-
* @see [source](https://github.com/nodejs/node/blob/v16.
|
|
4
|
+
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/https.js)
|
|
5
5
|
*/
|
|
6
6
|
declare module 'https' {
|
|
7
7
|
import { Duplex } from 'node:stream';
|
node/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Type definitions for non-npm package Node.js 16.
|
|
1
|
+
// Type definitions for non-npm package Node.js 16.7
|
|
2
2
|
// Project: http://nodejs.org/
|
|
3
3
|
// Definitions by: Microsoft TypeScript <https://github.com/Microsoft>
|
|
4
4
|
// DefinitelyTyped <https://github.com/DefinitelyTyped>
|
|
@@ -69,16 +69,63 @@
|
|
|
69
69
|
* IN THE SOFTWARE.
|
|
70
70
|
*/
|
|
71
71
|
|
|
72
|
-
// NOTE: These definitions support NodeJS and TypeScript 3.7
|
|
73
|
-
// Typically type modifications should be made in base.d.ts instead of here
|
|
72
|
+
// NOTE: These definitions support NodeJS and TypeScript 3.7+.
|
|
74
73
|
|
|
75
|
-
|
|
74
|
+
// Reference required types from the default lib:
|
|
75
|
+
/// <reference lib="es2020" />
|
|
76
|
+
/// <reference lib="esnext.asynciterable" />
|
|
77
|
+
/// <reference lib="esnext.intl" />
|
|
78
|
+
/// <reference lib="esnext.bigint" />
|
|
76
79
|
|
|
77
|
-
//
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
80
|
+
// Base definitions for all NodeJS modules that are not specific to any version of TypeScript:
|
|
81
|
+
/// <reference path="assert.d.ts" />
|
|
82
|
+
/// <reference path="assert/strict.d.ts" />
|
|
83
|
+
/// <reference path="globals.d.ts" />
|
|
84
|
+
/// <reference path="async_hooks.d.ts" />
|
|
85
|
+
/// <reference path="buffer.d.ts" />
|
|
86
|
+
/// <reference path="child_process.d.ts" />
|
|
87
|
+
/// <reference path="cluster.d.ts" />
|
|
88
|
+
/// <reference path="console.d.ts" />
|
|
89
|
+
/// <reference path="constants.d.ts" />
|
|
90
|
+
/// <reference path="crypto.d.ts" />
|
|
91
|
+
/// <reference path="dgram.d.ts" />
|
|
92
|
+
/// <reference path="diagnostics_channel.d.ts" />
|
|
93
|
+
/// <reference path="dns.d.ts" />
|
|
94
|
+
/// <reference path="dns/promises.d.ts" />
|
|
95
|
+
/// <reference path="dns/promises.d.ts" />
|
|
96
|
+
/// <reference path="domain.d.ts" />
|
|
97
|
+
/// <reference path="events.d.ts" />
|
|
98
|
+
/// <reference path="fs.d.ts" />
|
|
99
|
+
/// <reference path="fs/promises.d.ts" />
|
|
100
|
+
/// <reference path="http.d.ts" />
|
|
101
|
+
/// <reference path="http2.d.ts" />
|
|
102
|
+
/// <reference path="https.d.ts" />
|
|
103
|
+
/// <reference path="inspector.d.ts" />
|
|
104
|
+
/// <reference path="module.d.ts" />
|
|
105
|
+
/// <reference path="net.d.ts" />
|
|
106
|
+
/// <reference path="os.d.ts" />
|
|
107
|
+
/// <reference path="path.d.ts" />
|
|
108
|
+
/// <reference path="perf_hooks.d.ts" />
|
|
109
|
+
/// <reference path="process.d.ts" />
|
|
110
|
+
/// <reference path="punycode.d.ts" />
|
|
111
|
+
/// <reference path="querystring.d.ts" />
|
|
112
|
+
/// <reference path="readline.d.ts" />
|
|
113
|
+
/// <reference path="repl.d.ts" />
|
|
114
|
+
/// <reference path="stream.d.ts" />
|
|
115
|
+
/// <reference path="stream/promises.d.ts" />
|
|
116
|
+
/// <reference path="stream/web.d.ts" />
|
|
117
|
+
/// <reference path="string_decoder.d.ts" />
|
|
118
|
+
/// <reference path="timers.d.ts" />
|
|
119
|
+
/// <reference path="timers/promises.d.ts" />
|
|
120
|
+
/// <reference path="tls.d.ts" />
|
|
121
|
+
/// <reference path="trace_events.d.ts" />
|
|
122
|
+
/// <reference path="tty.d.ts" />
|
|
123
|
+
/// <reference path="url.d.ts" />
|
|
124
|
+
/// <reference path="util.d.ts" />
|
|
125
|
+
/// <reference path="v8.d.ts" />
|
|
126
|
+
/// <reference path="vm.d.ts" />
|
|
127
|
+
/// <reference path="wasi.d.ts" />
|
|
128
|
+
/// <reference path="worker_threads.d.ts" />
|
|
129
|
+
/// <reference path="zlib.d.ts" />
|
|
81
130
|
|
|
82
|
-
|
|
83
|
-
// within the respective ~/ts3.6 (or later) folder. However, this is disallowed for versions
|
|
84
|
-
// prior to TypeScript 3.6, so the older definitions will be found here.
|
|
131
|
+
/// <reference path="globals.global.d.ts" />
|
node/inspector.d.ts
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* ```js
|
|
16
16
|
* const inspector = require('inspector');
|
|
17
17
|
* ```
|
|
18
|
-
* @see [source](https://github.com/nodejs/node/blob/v16.
|
|
18
|
+
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/inspector.js)
|
|
19
19
|
*/
|
|
20
20
|
declare module 'inspector' {
|
|
21
21
|
import EventEmitter = require('node:events');
|
node/net.d.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* ```js
|
|
11
11
|
* const net = require('net');
|
|
12
12
|
* ```
|
|
13
|
-
* @see [source](https://github.com/nodejs/node/blob/v16.
|
|
13
|
+
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/net.js)
|
|
14
14
|
*/
|
|
15
15
|
declare module 'net' {
|
|
16
16
|
import * as stream from 'node:stream';
|
|
@@ -99,7 +99,7 @@ declare module 'net' {
|
|
|
99
99
|
* * `socket.connect(options[, connectListener])`
|
|
100
100
|
* * `socket.connect(path[, connectListener])` for `IPC` connections.
|
|
101
101
|
* * `socket.connect(port[, host][, connectListener])` for TCP connections.
|
|
102
|
-
* * Returns:
|
|
102
|
+
* * Returns: `net.Socket` The socket itself.
|
|
103
103
|
*
|
|
104
104
|
* This function is asynchronous. When the connection is established, the `'connect'` event will be emitted. If there is a problem connecting,
|
|
105
105
|
* instead of a `'connect'` event, an `'error'` event will be emitted with
|
node/os.d.ts
CHANGED
node/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@types/node",
|
|
3
|
-
"version": "16.
|
|
3
|
+
"version": "16.7.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",
|
|
@@ -223,13 +223,6 @@
|
|
|
223
223
|
],
|
|
224
224
|
"main": "",
|
|
225
225
|
"types": "index.d.ts",
|
|
226
|
-
"typesVersions": {
|
|
227
|
-
"<=3.6": {
|
|
228
|
-
"*": [
|
|
229
|
-
"ts3.6/*"
|
|
230
|
-
]
|
|
231
|
-
}
|
|
232
|
-
},
|
|
233
226
|
"repository": {
|
|
234
227
|
"type": "git",
|
|
235
228
|
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
|
@@ -237,6 +230,6 @@
|
|
|
237
230
|
},
|
|
238
231
|
"scripts": {},
|
|
239
232
|
"dependencies": {},
|
|
240
|
-
"typesPublisherContentHash": "
|
|
241
|
-
"typeScriptVersion": "3.
|
|
233
|
+
"typesPublisherContentHash": "e69ff975ff05f7fa6ee5e27b53994fc27f754f5397951611c387e09a08af0ce1",
|
|
234
|
+
"typeScriptVersion": "3.7"
|
|
242
235
|
}
|
node/path.d.ts
CHANGED
|
@@ -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/v16.
|
|
16
|
+
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/path.js)
|
|
17
17
|
*/
|
|
18
18
|
declare module 'path' {
|
|
19
19
|
namespace path {
|