@rio-cloud/cdk-v2-constructs 8.2.0-alpha.0 → 8.2.1-alpha.0
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.
- package/.jsii +2 -2
- package/node_modules/@types/node/README.md +3 -3
- package/node_modules/@types/node/assert/strict.d.ts +105 -2
- package/node_modules/@types/node/assert.d.ts +211 -92
- package/node_modules/@types/node/async_hooks.d.ts +103 -19
- package/node_modules/@types/node/buffer.buffer.d.ts +472 -0
- package/node_modules/@types/node/buffer.d.ts +88 -516
- package/node_modules/@types/node/child_process.d.ts +167 -231
- package/node_modules/@types/node/cluster.d.ts +172 -26
- package/node_modules/@types/node/compatibility/iterators.d.ts +21 -0
- package/node_modules/@types/node/console.d.ts +66 -28
- package/node_modules/@types/node/constants.d.ts +14 -12
- package/node_modules/@types/node/crypto.d.ts +1458 -497
- package/node_modules/@types/node/dgram.d.ts +44 -30
- package/node_modules/@types/node/diagnostics_channel.d.ts +389 -4
- package/node_modules/@types/node/dns/promises.d.ts +120 -42
- package/node_modules/@types/node/dns.d.ts +209 -95
- package/node_modules/@types/node/domain.d.ts +14 -18
- package/node_modules/@types/node/events.d.ts +245 -113
- package/node_modules/@types/node/fs/promises.d.ts +194 -96
- package/node_modules/@types/node/fs.d.ts +695 -270
- package/node_modules/@types/node/globals.d.ts +97 -308
- package/node_modules/@types/node/globals.typedarray.d.ts +41 -0
- package/node_modules/@types/node/http.d.ts +363 -97
- package/node_modules/@types/node/http2.d.ts +684 -231
- package/node_modules/@types/node/https.d.ts +122 -87
- package/node_modules/@types/node/index.d.ts +24 -11
- package/node_modules/@types/node/inspector.d.ts +220 -2690
- package/node_modules/@types/node/inspector.generated.d.ts +4239 -0
- package/node_modules/@types/node/module.d.ts +705 -149
- package/node_modules/@types/node/net.d.ts +178 -54
- package/node_modules/@types/node/os.d.ts +47 -17
- package/node_modules/@types/node/package.json +22 -97
- package/node_modules/@types/node/path.d.ts +12 -3
- package/node_modules/@types/node/perf_hooks.d.ts +500 -97
- package/node_modules/@types/node/process.d.ts +657 -87
- package/node_modules/@types/node/punycode.d.ts +5 -5
- package/node_modules/@types/node/querystring.d.ts +24 -13
- package/node_modules/@types/node/readline/promises.d.ts +25 -14
- package/node_modules/@types/node/readline.d.ts +102 -41
- package/node_modules/@types/node/repl.d.ts +38 -30
- package/node_modules/@types/node/sea.d.ts +162 -0
- package/node_modules/@types/node/sqlite.d.ts +1040 -0
- package/node_modules/@types/node/stream/consumers.d.ts +33 -7
- package/node_modules/@types/node/stream/promises.d.ts +8 -1
- package/node_modules/@types/node/stream/web.d.ts +251 -28
- package/node_modules/@types/node/stream.d.ts +1060 -1055
- package/node_modules/@types/node/string_decoder.d.ts +8 -8
- package/node_modules/@types/node/test.d.ts +2133 -1166
- package/node_modules/@types/node/timers/promises.d.ts +31 -16
- package/node_modules/@types/node/timers.d.ts +159 -114
- package/node_modules/@types/node/tls.d.ts +232 -163
- package/node_modules/@types/node/trace_events.d.ts +43 -28
- package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +468 -0
- package/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +71 -0
- package/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +36 -0
- package/node_modules/@types/node/ts5.6/index.d.ts +103 -0
- package/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +72 -0
- package/node_modules/@types/node/ts5.7/index.d.ts +103 -0
- package/node_modules/@types/node/tty.d.ts +9 -9
- package/node_modules/@types/node/url.d.ts +236 -84
- package/node_modules/@types/node/util.d.ts +562 -412
- package/node_modules/@types/node/v8.d.ts +368 -21
- package/node_modules/@types/node/vm.d.ts +443 -149
- package/node_modules/@types/node/wasi.d.ts +62 -18
- package/node_modules/@types/node/web-globals/abortcontroller.d.ts +34 -0
- package/node_modules/@types/node/web-globals/crypto.d.ts +32 -0
- package/node_modules/@types/node/web-globals/domexception.d.ts +68 -0
- package/node_modules/@types/node/web-globals/events.d.ts +97 -0
- package/node_modules/@types/node/web-globals/fetch.d.ts +62 -0
- package/node_modules/@types/node/web-globals/navigator.d.ts +25 -0
- package/node_modules/@types/node/web-globals/storage.d.ts +24 -0
- package/node_modules/@types/node/web-globals/streams.d.ts +22 -0
- package/node_modules/@types/node/worker_threads.d.ts +310 -107
- package/node_modules/@types/node/zlib.d.ts +301 -73
- package/node_modules/undici-types/LICENSE +21 -0
- package/node_modules/undici-types/agent.d.ts +13 -12
- package/node_modules/undici-types/api.d.ts +26 -26
- package/node_modules/undici-types/balanced-pool.d.ts +19 -7
- package/node_modules/undici-types/cache-interceptor.d.ts +173 -0
- package/node_modules/undici-types/client-stats.d.ts +15 -0
- package/node_modules/undici-types/client.d.ts +26 -15
- package/node_modules/undici-types/connector.d.ts +2 -2
- package/node_modules/undici-types/cookies.d.ts +2 -0
- package/node_modules/undici-types/diagnostics-channel.d.ts +19 -12
- package/node_modules/undici-types/dispatcher.d.ts +148 -113
- package/node_modules/undici-types/env-http-proxy-agent.d.ts +22 -0
- package/node_modules/undici-types/errors.d.ts +79 -46
- package/node_modules/undici-types/eventsource.d.ts +66 -0
- package/node_modules/undici-types/fetch.d.ts +41 -39
- package/node_modules/undici-types/formdata.d.ts +8 -8
- package/node_modules/undici-types/global-dispatcher.d.ts +4 -4
- package/node_modules/undici-types/global-origin.d.ts +5 -5
- package/node_modules/undici-types/h2c-client.d.ts +73 -0
- package/node_modules/undici-types/handlers.d.ts +11 -5
- package/node_modules/undici-types/header.d.ts +157 -1
- package/node_modules/undici-types/index.d.ts +68 -43
- package/node_modules/undici-types/interceptors.d.ts +71 -3
- package/node_modules/undici-types/mock-agent.d.ts +36 -18
- package/node_modules/undici-types/mock-call-history.d.ts +111 -0
- package/node_modules/undici-types/mock-client.d.ts +6 -4
- package/node_modules/undici-types/mock-errors.d.ts +3 -3
- package/node_modules/undici-types/mock-interceptor.d.ts +24 -23
- package/node_modules/undici-types/mock-pool.d.ts +6 -4
- package/node_modules/undici-types/package.json +1 -1
- package/node_modules/undici-types/patch.d.ts +0 -42
- package/node_modules/undici-types/pool-stats.d.ts +8 -8
- package/node_modules/undici-types/pool.d.ts +21 -8
- package/node_modules/undici-types/proxy-agent.d.ts +5 -6
- package/node_modules/undici-types/readable.d.ts +24 -17
- package/node_modules/undici-types/retry-agent.d.ts +8 -0
- package/node_modules/undici-types/retry-handler.d.ts +125 -0
- package/node_modules/undici-types/round-robin-pool.d.ts +41 -0
- package/node_modules/undici-types/snapshot-agent.d.ts +109 -0
- package/node_modules/undici-types/util.d.ts +18 -0
- package/node_modules/undici-types/utility.d.ts +7 -0
- package/node_modules/undici-types/webidl.d.ts +157 -36
- package/node_modules/undici-types/websocket.d.ts +67 -12
- package/package.json +9 -60
- package/version.json +1 -1
- package/node_modules/@types/node/dom-events.d.ts +0 -122
- package/node_modules/@types/node/globals.global.d.ts +0 -1
- package/node_modules/@types/node/ts4.8/assert/strict.d.ts +0 -8
- package/node_modules/@types/node/ts4.8/assert.d.ts +0 -996
- package/node_modules/@types/node/ts4.8/async_hooks.d.ts +0 -539
- package/node_modules/@types/node/ts4.8/buffer.d.ts +0 -2362
- package/node_modules/@types/node/ts4.8/child_process.d.ts +0 -1540
- package/node_modules/@types/node/ts4.8/cluster.d.ts +0 -432
- package/node_modules/@types/node/ts4.8/console.d.ts +0 -415
- package/node_modules/@types/node/ts4.8/constants.d.ts +0 -19
- package/node_modules/@types/node/ts4.8/crypto.d.ts +0 -4455
- package/node_modules/@types/node/ts4.8/dgram.d.ts +0 -586
- package/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +0 -191
- package/node_modules/@types/node/ts4.8/dns/promises.d.ts +0 -425
- package/node_modules/@types/node/ts4.8/dns.d.ts +0 -809
- package/node_modules/@types/node/ts4.8/dom-events.d.ts +0 -122
- package/node_modules/@types/node/ts4.8/domain.d.ts +0 -170
- package/node_modules/@types/node/ts4.8/events.d.ts +0 -796
- package/node_modules/@types/node/ts4.8/fs/promises.d.ts +0 -1232
- package/node_modules/@types/node/ts4.8/fs.d.ts +0 -4289
- package/node_modules/@types/node/ts4.8/globals.d.ts +0 -381
- package/node_modules/@types/node/ts4.8/globals.global.d.ts +0 -1
- package/node_modules/@types/node/ts4.8/http.d.ts +0 -1888
- package/node_modules/@types/node/ts4.8/http2.d.ts +0 -2382
- package/node_modules/@types/node/ts4.8/https.d.ts +0 -550
- package/node_modules/@types/node/ts4.8/index.d.ts +0 -88
- package/node_modules/@types/node/ts4.8/inspector.d.ts +0 -2747
- package/node_modules/@types/node/ts4.8/module.d.ts +0 -287
- package/node_modules/@types/node/ts4.8/net.d.ts +0 -949
- package/node_modules/@types/node/ts4.8/os.d.ts +0 -477
- package/node_modules/@types/node/ts4.8/path.d.ts +0 -191
- package/node_modules/@types/node/ts4.8/perf_hooks.d.ts +0 -639
- package/node_modules/@types/node/ts4.8/process.d.ts +0 -1532
- package/node_modules/@types/node/ts4.8/punycode.d.ts +0 -117
- package/node_modules/@types/node/ts4.8/querystring.d.ts +0 -141
- package/node_modules/@types/node/ts4.8/readline/promises.d.ts +0 -150
- package/node_modules/@types/node/ts4.8/readline.d.ts +0 -539
- package/node_modules/@types/node/ts4.8/repl.d.ts +0 -430
- package/node_modules/@types/node/ts4.8/stream/consumers.d.ts +0 -12
- package/node_modules/@types/node/ts4.8/stream/promises.d.ts +0 -83
- package/node_modules/@types/node/ts4.8/stream/web.d.ts +0 -350
- package/node_modules/@types/node/ts4.8/stream.d.ts +0 -1701
- package/node_modules/@types/node/ts4.8/string_decoder.d.ts +0 -67
- package/node_modules/@types/node/ts4.8/test.d.ts +0 -1382
- package/node_modules/@types/node/ts4.8/timers/promises.d.ts +0 -93
- package/node_modules/@types/node/ts4.8/timers.d.ts +0 -240
- package/node_modules/@types/node/ts4.8/tls.d.ts +0 -1210
- package/node_modules/@types/node/ts4.8/trace_events.d.ts +0 -182
- package/node_modules/@types/node/ts4.8/tty.d.ts +0 -208
- package/node_modules/@types/node/ts4.8/url.d.ts +0 -927
- package/node_modules/@types/node/ts4.8/util.d.ts +0 -2186
- package/node_modules/@types/node/ts4.8/v8.d.ts +0 -635
- package/node_modules/@types/node/ts4.8/vm.d.ts +0 -901
- package/node_modules/@types/node/ts4.8/wasi.d.ts +0 -158
- package/node_modules/@types/node/ts4.8/worker_threads.d.ts +0 -691
- package/node_modules/@types/node/ts4.8/zlib.d.ts +0 -517
- package/node_modules/argparse/CHANGELOG.md +0 -216
- package/node_modules/undici-types/file.d.ts +0 -39
- package/node_modules/undici-types/filereader.d.ts +0 -54
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* @since v10.0.0
|
|
10
10
|
*/
|
|
11
11
|
declare module "fs/promises" {
|
|
12
|
+
import { NonSharedBuffer } from "node:buffer";
|
|
12
13
|
import { Abortable } from "node:events";
|
|
13
14
|
import { Stream } from "node:stream";
|
|
14
15
|
import { ReadableStream } from "node:stream/web";
|
|
@@ -20,12 +21,19 @@ declare module "fs/promises" {
|
|
|
20
21
|
CopyOptions,
|
|
21
22
|
Dir,
|
|
22
23
|
Dirent,
|
|
24
|
+
EncodingOption,
|
|
25
|
+
GlobOptions,
|
|
26
|
+
GlobOptionsWithFileTypes,
|
|
27
|
+
GlobOptionsWithoutFileTypes,
|
|
23
28
|
MakeDirectoryOptions,
|
|
24
29
|
Mode,
|
|
25
30
|
ObjectEncodingOptions,
|
|
26
31
|
OpenDirOptions,
|
|
27
32
|
OpenMode,
|
|
28
33
|
PathLike,
|
|
34
|
+
ReadOptions,
|
|
35
|
+
ReadOptionsWithBuffer,
|
|
36
|
+
ReadPosition,
|
|
29
37
|
ReadStream,
|
|
30
38
|
ReadVResult,
|
|
31
39
|
RmDirOptions,
|
|
@@ -36,7 +44,7 @@ declare module "fs/promises" {
|
|
|
36
44
|
StatsFs,
|
|
37
45
|
TimeLike,
|
|
38
46
|
WatchEventType,
|
|
39
|
-
WatchOptions,
|
|
47
|
+
WatchOptions as _WatchOptions,
|
|
40
48
|
WriteStream,
|
|
41
49
|
WriteVResult,
|
|
42
50
|
} from "node:fs";
|
|
@@ -53,6 +61,7 @@ declare module "fs/promises" {
|
|
|
53
61
|
bytesRead: number;
|
|
54
62
|
buffer: T;
|
|
55
63
|
}
|
|
64
|
+
/** @deprecated This interface will be removed in a future version. Use `import { ReadOptionsWithBuffer } from "node:fs"` instead. */
|
|
56
65
|
interface FileReadOptions<T extends NodeJS.ArrayBufferView = Buffer> {
|
|
57
66
|
/**
|
|
58
67
|
* @default `Buffer.alloc(0xffff)`
|
|
@@ -66,9 +75,9 @@ declare module "fs/promises" {
|
|
|
66
75
|
* @default `buffer.byteLength`
|
|
67
76
|
*/
|
|
68
77
|
length?: number | null;
|
|
69
|
-
position?:
|
|
78
|
+
position?: ReadPosition | null;
|
|
70
79
|
}
|
|
71
|
-
interface CreateReadStreamOptions {
|
|
80
|
+
interface CreateReadStreamOptions extends Abortable {
|
|
72
81
|
encoding?: BufferEncoding | null | undefined;
|
|
73
82
|
autoClose?: boolean | undefined;
|
|
74
83
|
emitClose?: boolean | undefined;
|
|
@@ -82,13 +91,10 @@ declare module "fs/promises" {
|
|
|
82
91
|
emitClose?: boolean | undefined;
|
|
83
92
|
start?: number | undefined;
|
|
84
93
|
highWaterMark?: number | undefined;
|
|
94
|
+
flush?: boolean | undefined;
|
|
85
95
|
}
|
|
86
96
|
interface ReadableWebStreamOptions {
|
|
87
|
-
|
|
88
|
-
* Whether to open a normal or a `'bytes'` stream.
|
|
89
|
-
* @since v20.0.0
|
|
90
|
-
*/
|
|
91
|
-
type?: "bytes" | undefined;
|
|
97
|
+
autoClose?: boolean | undefined;
|
|
92
98
|
}
|
|
93
99
|
// TODO: Add `EventEmitter` close
|
|
94
100
|
interface FileHandle {
|
|
@@ -107,7 +113,10 @@ declare module "fs/promises" {
|
|
|
107
113
|
*/
|
|
108
114
|
appendFile(
|
|
109
115
|
data: string | Uint8Array,
|
|
110
|
-
options?:
|
|
116
|
+
options?:
|
|
117
|
+
| (ObjectEncodingOptions & Abortable)
|
|
118
|
+
| BufferEncoding
|
|
119
|
+
| null,
|
|
111
120
|
): Promise<void>;
|
|
112
121
|
/**
|
|
113
122
|
* Changes the ownership of the file. A wrapper for [`chown(2)`](http://man7.org/linux/man-pages/man2/chown.2.html).
|
|
@@ -185,7 +194,7 @@ declare module "fs/promises" {
|
|
|
185
194
|
* replacing it may require the `flags` `open` option to be set to `r+` rather than
|
|
186
195
|
* the default `r`. The `encoding` can be any one of those accepted by `Buffer`.
|
|
187
196
|
*
|
|
188
|
-
* If `autoClose` is set to true (default behavior) on `'error'` or `'finish'`the file descriptor will be closed automatically. If `autoClose` is false,
|
|
197
|
+
* If `autoClose` is set to true (default behavior) on `'error'` or `'finish'` the file descriptor will be closed automatically. If `autoClose` is false,
|
|
189
198
|
* then the file descriptor won't be closed, even if there's an error.
|
|
190
199
|
* It is the application's responsibility to close it and make sure there's no
|
|
191
200
|
* file descriptor leak.
|
|
@@ -229,11 +238,18 @@ declare module "fs/promises" {
|
|
|
229
238
|
buffer: T,
|
|
230
239
|
offset?: number | null,
|
|
231
240
|
length?: number | null,
|
|
232
|
-
position?:
|
|
241
|
+
position?: ReadPosition | null,
|
|
242
|
+
): Promise<FileReadResult<T>>;
|
|
243
|
+
read<T extends NodeJS.ArrayBufferView>(
|
|
244
|
+
buffer: T,
|
|
245
|
+
options?: ReadOptions,
|
|
246
|
+
): Promise<FileReadResult<T>>;
|
|
247
|
+
read<T extends NodeJS.ArrayBufferView = NonSharedBuffer>(
|
|
248
|
+
options?: ReadOptionsWithBuffer<T>,
|
|
233
249
|
): Promise<FileReadResult<T>>;
|
|
234
|
-
read<T extends NodeJS.ArrayBufferView = Buffer>(options?: FileReadOptions<T>): Promise<FileReadResult<T>>;
|
|
235
250
|
/**
|
|
236
|
-
* Returns a `ReadableStream` that may be used to read the
|
|
251
|
+
* Returns a byte-oriented `ReadableStream` that may be used to read the file's
|
|
252
|
+
* contents.
|
|
237
253
|
*
|
|
238
254
|
* An error will be thrown if this method is called more than once or is called
|
|
239
255
|
* after the `FileHandle` is closed or closing.
|
|
@@ -254,7 +270,6 @@ declare module "fs/promises" {
|
|
|
254
270
|
* While the `ReadableStream` will read the file to completion, it will not
|
|
255
271
|
* close the `FileHandle` automatically. User code must still call the`fileHandle.close()` method.
|
|
256
272
|
* @since v17.0.0
|
|
257
|
-
* @experimental
|
|
258
273
|
*/
|
|
259
274
|
readableWebStream(options?: ReadableWebStreamOptions): ReadableStream;
|
|
260
275
|
/**
|
|
@@ -264,7 +279,7 @@ declare module "fs/promises" {
|
|
|
264
279
|
*
|
|
265
280
|
* The `FileHandle` has to support reading.
|
|
266
281
|
*
|
|
267
|
-
* If one or more `filehandle.read()` calls are made on a file handle and then a`filehandle.readFile()` call is made, the data will be read from the current
|
|
282
|
+
* If one or more `filehandle.read()` calls are made on a file handle and then a `filehandle.readFile()` call is made, the data will be read from the current
|
|
268
283
|
* position till the end of the file. It doesn't always read from the beginning
|
|
269
284
|
* of the file.
|
|
270
285
|
* @since v10.0.0
|
|
@@ -272,39 +287,29 @@ declare module "fs/promises" {
|
|
|
272
287
|
* data will be a string.
|
|
273
288
|
*/
|
|
274
289
|
readFile(
|
|
275
|
-
options?:
|
|
276
|
-
encoding?: null | undefined
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
): Promise<Buffer>;
|
|
290
|
+
options?:
|
|
291
|
+
| ({ encoding?: null | undefined } & Abortable)
|
|
292
|
+
| null,
|
|
293
|
+
): Promise<NonSharedBuffer>;
|
|
280
294
|
/**
|
|
281
295
|
* Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically.
|
|
282
296
|
* The `FileHandle` must have been opened for reading.
|
|
283
|
-
* @param options An object that may contain an optional flag.
|
|
284
|
-
* If a flag is not provided, it defaults to `'r'`.
|
|
285
297
|
*/
|
|
286
298
|
readFile(
|
|
287
299
|
options:
|
|
288
|
-
| {
|
|
289
|
-
encoding: BufferEncoding;
|
|
290
|
-
flag?: OpenMode | undefined;
|
|
291
|
-
}
|
|
300
|
+
| ({ encoding: BufferEncoding } & Abortable)
|
|
292
301
|
| BufferEncoding,
|
|
293
302
|
): Promise<string>;
|
|
294
303
|
/**
|
|
295
304
|
* Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically.
|
|
296
305
|
* The `FileHandle` must have been opened for reading.
|
|
297
|
-
* @param options An object that may contain an optional flag.
|
|
298
|
-
* If a flag is not provided, it defaults to `'r'`.
|
|
299
306
|
*/
|
|
300
307
|
readFile(
|
|
301
308
|
options?:
|
|
302
|
-
| (ObjectEncodingOptions &
|
|
303
|
-
flag?: OpenMode | undefined;
|
|
304
|
-
})
|
|
309
|
+
| (ObjectEncodingOptions & Abortable)
|
|
305
310
|
| BufferEncoding
|
|
306
311
|
| null,
|
|
307
|
-
): Promise<string |
|
|
312
|
+
): Promise<string | NonSharedBuffer>;
|
|
308
313
|
/**
|
|
309
314
|
* Convenience method to create a `readline` interface and stream over the file.
|
|
310
315
|
* See `filehandle.createReadStream()` for the options.
|
|
@@ -366,22 +371,22 @@ declare module "fs/promises" {
|
|
|
366
371
|
*/
|
|
367
372
|
truncate(len?: number): Promise<void>;
|
|
368
373
|
/**
|
|
369
|
-
* Change the file system timestamps of the object referenced by the `FileHandle` then
|
|
374
|
+
* Change the file system timestamps of the object referenced by the `FileHandle` then fulfills the promise with no arguments upon success.
|
|
370
375
|
* @since v10.0.0
|
|
371
376
|
*/
|
|
372
377
|
utimes(atime: TimeLike, mtime: TimeLike): Promise<void>;
|
|
373
378
|
/**
|
|
374
|
-
* Asynchronously writes data to a file, replacing the file if it already exists
|
|
379
|
+
* Asynchronously writes data to a file, replacing the file if it already exists. `data` can be a string, a buffer, an
|
|
375
380
|
* [AsyncIterable](https://tc39.github.io/ecma262/#sec-asynciterable-interface), or an
|
|
376
381
|
* [Iterable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#The_iterable_protocol) object.
|
|
377
|
-
* The promise is
|
|
382
|
+
* The promise is fulfilled with no arguments upon success.
|
|
378
383
|
*
|
|
379
384
|
* If `options` is a string, then it specifies the `encoding`.
|
|
380
385
|
*
|
|
381
386
|
* The `FileHandle` has to support writing.
|
|
382
387
|
*
|
|
383
388
|
* It is unsafe to use `filehandle.writeFile()` multiple times on the same file
|
|
384
|
-
* without waiting for the promise to be
|
|
389
|
+
* without waiting for the promise to be fulfilled (or rejected).
|
|
385
390
|
*
|
|
386
391
|
* If one or more `filehandle.write()` calls are made on a file handle and then a`filehandle.writeFile()` call is made, the data will be written from the
|
|
387
392
|
* current position till the end of the file. It doesn't always write from the
|
|
@@ -390,15 +395,18 @@ declare module "fs/promises" {
|
|
|
390
395
|
*/
|
|
391
396
|
writeFile(
|
|
392
397
|
data: string | Uint8Array,
|
|
393
|
-
options?:
|
|
398
|
+
options?:
|
|
399
|
+
| (ObjectEncodingOptions & Abortable)
|
|
400
|
+
| BufferEncoding
|
|
401
|
+
| null,
|
|
394
402
|
): Promise<void>;
|
|
395
403
|
/**
|
|
396
404
|
* Write `buffer` to the file.
|
|
397
405
|
*
|
|
398
|
-
* The promise is
|
|
406
|
+
* The promise is fulfilled with an object containing two properties:
|
|
399
407
|
*
|
|
400
408
|
* It is unsafe to use `filehandle.write()` multiple times on the same file
|
|
401
|
-
* without waiting for the promise to be
|
|
409
|
+
* without waiting for the promise to be fulfilled (or rejected). For this
|
|
402
410
|
* scenario, use `filehandle.createWriteStream()`.
|
|
403
411
|
*
|
|
404
412
|
* On Linux, positional writes do not work when the file is opened in append mode.
|
|
@@ -410,7 +418,7 @@ declare module "fs/promises" {
|
|
|
410
418
|
* @param [position='null'] The offset from the beginning of the file where the data from `buffer` should be written. If `position` is not a `number`, the data will be written at the current
|
|
411
419
|
* position. See the POSIX pwrite(2) documentation for more detail.
|
|
412
420
|
*/
|
|
413
|
-
write<TBuffer extends
|
|
421
|
+
write<TBuffer extends NodeJS.ArrayBufferView>(
|
|
414
422
|
buffer: TBuffer,
|
|
415
423
|
offset?: number | null,
|
|
416
424
|
length?: number | null,
|
|
@@ -419,6 +427,13 @@ declare module "fs/promises" {
|
|
|
419
427
|
bytesWritten: number;
|
|
420
428
|
buffer: TBuffer;
|
|
421
429
|
}>;
|
|
430
|
+
write<TBuffer extends Uint8Array>(
|
|
431
|
+
buffer: TBuffer,
|
|
432
|
+
options?: { offset?: number; length?: number; position?: number },
|
|
433
|
+
): Promise<{
|
|
434
|
+
bytesWritten: number;
|
|
435
|
+
buffer: TBuffer;
|
|
436
|
+
}>;
|
|
422
437
|
write(
|
|
423
438
|
data: string,
|
|
424
439
|
position?: number | null,
|
|
@@ -430,10 +445,10 @@ declare module "fs/promises" {
|
|
|
430
445
|
/**
|
|
431
446
|
* Write an array of [ArrayBufferView](https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView) s to the file.
|
|
432
447
|
*
|
|
433
|
-
* The promise is
|
|
448
|
+
* The promise is fulfilled with an object containing a two properties:
|
|
434
449
|
*
|
|
435
450
|
* It is unsafe to call `writev()` multiple times on the same file without waiting
|
|
436
|
-
* for the promise to be
|
|
451
|
+
* for the promise to be fulfilled (or rejected).
|
|
437
452
|
*
|
|
438
453
|
* On Linux, positional writes don't work when the file is opened in append mode.
|
|
439
454
|
* The kernel ignores the position argument and always appends the data to
|
|
@@ -442,14 +457,20 @@ declare module "fs/promises" {
|
|
|
442
457
|
* @param [position='null'] The offset from the beginning of the file where the data from `buffers` should be written. If `position` is not a `number`, the data will be written at the current
|
|
443
458
|
* position.
|
|
444
459
|
*/
|
|
445
|
-
writev
|
|
460
|
+
writev<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
|
|
461
|
+
buffers: TBuffers,
|
|
462
|
+
position?: number,
|
|
463
|
+
): Promise<WriteVResult<TBuffers>>;
|
|
446
464
|
/**
|
|
447
465
|
* Read from a file and write to an array of [ArrayBufferView](https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView) s
|
|
448
466
|
* @since v13.13.0, v12.17.0
|
|
449
467
|
* @param [position='null'] The offset from the beginning of the file where the data should be read from. If `position` is not a `number`, the data will be read from the current position.
|
|
450
468
|
* @return Fulfills upon success an object containing two properties:
|
|
451
469
|
*/
|
|
452
|
-
readv
|
|
470
|
+
readv<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
|
|
471
|
+
buffers: TBuffers,
|
|
472
|
+
position?: number,
|
|
473
|
+
): Promise<ReadVResult<TBuffers>>;
|
|
453
474
|
/**
|
|
454
475
|
* Closes the file handle after waiting for any pending operation on the handle to
|
|
455
476
|
* complete.
|
|
@@ -469,8 +490,9 @@ declare module "fs/promises" {
|
|
|
469
490
|
*/
|
|
470
491
|
close(): Promise<void>;
|
|
471
492
|
/**
|
|
472
|
-
*
|
|
473
|
-
*
|
|
493
|
+
* Calls `filehandle.close()` and returns a promise that fulfills when the
|
|
494
|
+
* filehandle is closed.
|
|
495
|
+
* @since v20.4.0, v18.8.0
|
|
474
496
|
*/
|
|
475
497
|
[Symbol.asyncDispose](): Promise<void>;
|
|
476
498
|
}
|
|
@@ -478,11 +500,11 @@ declare module "fs/promises" {
|
|
|
478
500
|
/**
|
|
479
501
|
* Tests a user's permissions for the file or directory specified by `path`.
|
|
480
502
|
* The `mode` argument is an optional integer that specifies the accessibility
|
|
481
|
-
* checks to be performed. `mode` should be either the value `fs.constants.F_OK`or a mask consisting of the bitwise OR of any of `fs.constants.R_OK
|
|
503
|
+
* checks to be performed. `mode` should be either the value `fs.constants.F_OK` or a mask consisting of the bitwise OR of any of `fs.constants.R_OK`, `fs.constants.W_OK`, and `fs.constants.X_OK`
|
|
482
504
|
* (e.g.`fs.constants.W_OK | fs.constants.R_OK`). Check `File access constants` for
|
|
483
505
|
* possible values of `mode`.
|
|
484
506
|
*
|
|
485
|
-
* If the accessibility check is successful, the promise is
|
|
507
|
+
* If the accessibility check is successful, the promise is fulfilled with no
|
|
486
508
|
* value. If any of the accessibility checks fail, the promise is rejected
|
|
487
509
|
* with an [Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) object. The following example checks if the file`/etc/passwd` can be read and
|
|
488
510
|
* written by the current process.
|
|
@@ -563,7 +585,7 @@ declare module "fs/promises" {
|
|
|
563
585
|
*/
|
|
564
586
|
function rename(oldPath: PathLike, newPath: PathLike): Promise<void>;
|
|
565
587
|
/**
|
|
566
|
-
* Truncates (shortens or extends the length) of the content at `path` to `len`bytes.
|
|
588
|
+
* Truncates (shortens or extends the length) of the content at `path` to `len` bytes.
|
|
567
589
|
* @since v10.0.0
|
|
568
590
|
* @param [len=0]
|
|
569
591
|
* @return Fulfills with `undefined` upon success.
|
|
@@ -573,7 +595,7 @@ declare module "fs/promises" {
|
|
|
573
595
|
* Removes the directory identified by `path`.
|
|
574
596
|
*
|
|
575
597
|
* Using `fsPromises.rmdir()` on a file (not a directory) results in the
|
|
576
|
-
* promise being rejected with an `ENOENT` error on Windows and an `ENOTDIR`error on POSIX.
|
|
598
|
+
* promise being rejected with an `ENOENT` error on Windows and an `ENOTDIR` error on POSIX.
|
|
577
599
|
*
|
|
578
600
|
* To get a behavior similar to the `rm -rf` Unix command, use `fsPromises.rm()` with options `{ recursive: true, force: true }`.
|
|
579
601
|
* @since v10.0.0
|
|
@@ -590,7 +612,7 @@ declare module "fs/promises" {
|
|
|
590
612
|
* Asynchronously creates a directory.
|
|
591
613
|
*
|
|
592
614
|
* The optional `options` argument can be an integer specifying `mode` (permission
|
|
593
|
-
* and sticky bits), or an object with a `mode` property and a `recursive`property indicating whether parent directories should be created. Calling`fsPromises.mkdir()` when `path` is a directory
|
|
615
|
+
* and sticky bits), or an object with a `mode` property and a `recursive` property indicating whether parent directories should be created. Calling `fsPromises.mkdir()` when `path` is a directory
|
|
594
616
|
* that exists results in a
|
|
595
617
|
* rejection only when `recursive` is false.
|
|
596
618
|
*
|
|
@@ -645,7 +667,7 @@ declare module "fs/promises" {
|
|
|
645
667
|
* the filenames. If the `encoding` is set to `'buffer'`, the filenames returned
|
|
646
668
|
* will be passed as `Buffer` objects.
|
|
647
669
|
*
|
|
648
|
-
* If `options.withFileTypes` is set to `true`, the
|
|
670
|
+
* If `options.withFileTypes` is set to `true`, the returned array will contain `fs.Dirent` objects.
|
|
649
671
|
*
|
|
650
672
|
* ```js
|
|
651
673
|
* import { readdir } from 'node:fs/promises';
|
|
@@ -685,7 +707,7 @@ declare module "fs/promises" {
|
|
|
685
707
|
recursive?: boolean | undefined;
|
|
686
708
|
}
|
|
687
709
|
| "buffer",
|
|
688
|
-
): Promise<
|
|
710
|
+
): Promise<NonSharedBuffer[]>;
|
|
689
711
|
/**
|
|
690
712
|
* Asynchronous readdir(3) - read a directory.
|
|
691
713
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -700,7 +722,7 @@ declare module "fs/promises" {
|
|
|
700
722
|
})
|
|
701
723
|
| BufferEncoding
|
|
702
724
|
| null,
|
|
703
|
-
): Promise<string[] |
|
|
725
|
+
): Promise<string[] | NonSharedBuffer[]>;
|
|
704
726
|
/**
|
|
705
727
|
* Asynchronous readdir(3) - read a directory.
|
|
706
728
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -713,9 +735,22 @@ declare module "fs/promises" {
|
|
|
713
735
|
recursive?: boolean | undefined;
|
|
714
736
|
},
|
|
715
737
|
): Promise<Dirent[]>;
|
|
738
|
+
/**
|
|
739
|
+
* Asynchronous readdir(3) - read a directory.
|
|
740
|
+
* @param path A path to a directory. If a URL is provided, it must use the `file:` protocol.
|
|
741
|
+
* @param options Must include `withFileTypes: true` and `encoding: 'buffer'`.
|
|
742
|
+
*/
|
|
743
|
+
function readdir(
|
|
744
|
+
path: PathLike,
|
|
745
|
+
options: {
|
|
746
|
+
encoding: "buffer";
|
|
747
|
+
withFileTypes: true;
|
|
748
|
+
recursive?: boolean | undefined;
|
|
749
|
+
},
|
|
750
|
+
): Promise<Dirent<NonSharedBuffer>[]>;
|
|
716
751
|
/**
|
|
717
752
|
* Reads the contents of the symbolic link referred to by `path`. See the POSIX [`readlink(2)`](http://man7.org/linux/man-pages/man2/readlink.2.html) documentation for more detail. The promise is
|
|
718
|
-
*
|
|
753
|
+
* fulfilled with the`linkString` upon success.
|
|
719
754
|
*
|
|
720
755
|
* The optional `options` argument can be a string specifying an encoding, or an
|
|
721
756
|
* object with an `encoding` property specifying the character encoding to use for
|
|
@@ -730,17 +765,20 @@ declare module "fs/promises" {
|
|
|
730
765
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
731
766
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
732
767
|
*/
|
|
733
|
-
function readlink(path: PathLike, options: BufferEncodingOption): Promise<
|
|
768
|
+
function readlink(path: PathLike, options: BufferEncodingOption): Promise<NonSharedBuffer>;
|
|
734
769
|
/**
|
|
735
770
|
* Asynchronous readlink(2) - read value of a symbolic link.
|
|
736
771
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
737
772
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
738
773
|
*/
|
|
739
|
-
function readlink(
|
|
774
|
+
function readlink(
|
|
775
|
+
path: PathLike,
|
|
776
|
+
options?: ObjectEncodingOptions | string | null,
|
|
777
|
+
): Promise<string | NonSharedBuffer>;
|
|
740
778
|
/**
|
|
741
779
|
* Creates a symbolic link.
|
|
742
780
|
*
|
|
743
|
-
* The `type` argument is only used on Windows platforms and can be one of `'dir'
|
|
781
|
+
* The `type` argument is only used on Windows platforms and can be one of `'dir'`, `'file'`, or `'junction'`. If the `type` argument is not a string, Node.js will
|
|
744
782
|
* autodetect `target` type and use `'file'` or `'dir'`. If the `target` does not
|
|
745
783
|
* exist, `'file'` will be used. Windows junction points require the destination
|
|
746
784
|
* path to be absolute. When using `'junction'`, the `target` argument will
|
|
@@ -860,13 +898,13 @@ declare module "fs/promises" {
|
|
|
860
898
|
*
|
|
861
899
|
* * Values can be either numbers representing Unix epoch time, `Date`s, or a
|
|
862
900
|
* numeric string like `'123456789.0'`.
|
|
863
|
-
* * If the value can not be converted to a number, or is `NaN`, `Infinity`, or`-Infinity`, an `Error` will be thrown.
|
|
901
|
+
* * If the value can not be converted to a number, or is `NaN`, `Infinity`, or `-Infinity`, an `Error` will be thrown.
|
|
864
902
|
* @since v10.0.0
|
|
865
903
|
* @return Fulfills with `undefined` upon success.
|
|
866
904
|
*/
|
|
867
905
|
function utimes(path: PathLike, atime: TimeLike, mtime: TimeLike): Promise<void>;
|
|
868
906
|
/**
|
|
869
|
-
* Determines the actual location of `path` using the same semantics as the`fs.realpath.native()` function.
|
|
907
|
+
* Determines the actual location of `path` using the same semantics as the `fs.realpath.native()` function.
|
|
870
908
|
*
|
|
871
909
|
* Only paths that can be converted to UTF8 strings are supported.
|
|
872
910
|
*
|
|
@@ -887,7 +925,7 @@ declare module "fs/promises" {
|
|
|
887
925
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
888
926
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
889
927
|
*/
|
|
890
|
-
function realpath(path: PathLike, options: BufferEncodingOption): Promise<
|
|
928
|
+
function realpath(path: PathLike, options: BufferEncodingOption): Promise<NonSharedBuffer>;
|
|
891
929
|
/**
|
|
892
930
|
* Asynchronous realpath(3) - return the canonicalized absolute pathname.
|
|
893
931
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -896,7 +934,7 @@ declare module "fs/promises" {
|
|
|
896
934
|
function realpath(
|
|
897
935
|
path: PathLike,
|
|
898
936
|
options?: ObjectEncodingOptions | BufferEncoding | null,
|
|
899
|
-
): Promise<string |
|
|
937
|
+
): Promise<string | NonSharedBuffer>;
|
|
900
938
|
/**
|
|
901
939
|
* Creates a unique temporary directory. A unique directory name is generated by
|
|
902
940
|
* appending six random characters to the end of the provided `prefix`. Due to
|
|
@@ -920,9 +958,9 @@ declare module "fs/promises" {
|
|
|
920
958
|
* ```
|
|
921
959
|
*
|
|
922
960
|
* The `fsPromises.mkdtemp()` method will append the six randomly selected
|
|
923
|
-
* characters directly to the `prefix` string. For instance, given a directory`/tmp`, if the intention is to create a temporary directory _within_`/tmp`, the`prefix` must end with a trailing
|
|
961
|
+
* characters directly to the `prefix` string. For instance, given a directory `/tmp`, if the intention is to create a temporary directory _within_ `/tmp`, the `prefix` must end with a trailing
|
|
924
962
|
* platform-specific path separator
|
|
925
|
-
* (`
|
|
963
|
+
* (`import { sep } from 'node:path'`).
|
|
926
964
|
* @since v10.0.0
|
|
927
965
|
* @return Fulfills with a string containing the file system path of the newly created temporary directory.
|
|
928
966
|
*/
|
|
@@ -932,15 +970,52 @@ declare module "fs/promises" {
|
|
|
932
970
|
* Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory.
|
|
933
971
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
934
972
|
*/
|
|
935
|
-
function mkdtemp(prefix: string, options: BufferEncodingOption): Promise<
|
|
973
|
+
function mkdtemp(prefix: string, options: BufferEncodingOption): Promise<NonSharedBuffer>;
|
|
936
974
|
/**
|
|
937
975
|
* Asynchronously creates a unique temporary directory.
|
|
938
976
|
* Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory.
|
|
939
977
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
940
978
|
*/
|
|
941
|
-
function mkdtemp(
|
|
979
|
+
function mkdtemp(
|
|
980
|
+
prefix: string,
|
|
981
|
+
options?: ObjectEncodingOptions | BufferEncoding | null,
|
|
982
|
+
): Promise<string | NonSharedBuffer>;
|
|
983
|
+
interface DisposableTempDir extends AsyncDisposable {
|
|
984
|
+
/**
|
|
985
|
+
* The path of the created directory.
|
|
986
|
+
*/
|
|
987
|
+
path: string;
|
|
988
|
+
/**
|
|
989
|
+
* A function which removes the created directory.
|
|
990
|
+
*/
|
|
991
|
+
remove(): Promise<void>;
|
|
992
|
+
/**
|
|
993
|
+
* The same as `remove`.
|
|
994
|
+
*/
|
|
995
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
996
|
+
}
|
|
997
|
+
/**
|
|
998
|
+
* The resulting Promise holds an async-disposable object whose `path` property
|
|
999
|
+
* holds the created directory path. When the object is disposed, the directory
|
|
1000
|
+
* and its contents will be removed asynchronously if it still exists. If the
|
|
1001
|
+
* directory cannot be deleted, disposal will throw an error. The object has an
|
|
1002
|
+
* async `remove()` method which will perform the same task.
|
|
1003
|
+
*
|
|
1004
|
+
* Both this function and the disposal function on the resulting object are
|
|
1005
|
+
* async, so it should be used with `await` + `await using` as in
|
|
1006
|
+
* `await using dir = await fsPromises.mkdtempDisposable('prefix')`.
|
|
1007
|
+
*
|
|
1008
|
+
* <!-- TODO: link MDN docs for disposables once https://github.com/mdn/content/pull/38027 lands -->
|
|
1009
|
+
*
|
|
1010
|
+
* For detailed information, see the documentation of `fsPromises.mkdtemp()`.
|
|
1011
|
+
*
|
|
1012
|
+
* The optional `options` argument can be a string specifying an encoding, or an
|
|
1013
|
+
* object with an `encoding` property specifying the character encoding to use.
|
|
1014
|
+
* @since v24.4.0
|
|
1015
|
+
*/
|
|
1016
|
+
function mkdtempDisposable(prefix: PathLike, options?: EncodingOption): Promise<DisposableTempDir>;
|
|
942
1017
|
/**
|
|
943
|
-
* Asynchronously writes data to a file, replacing the file if it already exists
|
|
1018
|
+
* Asynchronously writes data to a file, replacing the file if it already exists. `data` can be a string, a buffer, an
|
|
944
1019
|
* [AsyncIterable](https://tc39.github.io/ecma262/#sec-asynciterable-interface), or an
|
|
945
1020
|
* [Iterable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#The_iterable_protocol) object.
|
|
946
1021
|
*
|
|
@@ -1001,6 +1076,12 @@ declare module "fs/promises" {
|
|
|
1001
1076
|
| (ObjectEncodingOptions & {
|
|
1002
1077
|
mode?: Mode | undefined;
|
|
1003
1078
|
flag?: OpenMode | undefined;
|
|
1079
|
+
/**
|
|
1080
|
+
* If all data is successfully written to the file, and `flush`
|
|
1081
|
+
* is `true`, `filehandle.sync()` is used to flush the data.
|
|
1082
|
+
* @default false
|
|
1083
|
+
*/
|
|
1084
|
+
flush?: boolean | undefined;
|
|
1004
1085
|
} & Abortable)
|
|
1005
1086
|
| BufferEncoding
|
|
1006
1087
|
| null,
|
|
@@ -1022,7 +1103,7 @@ declare module "fs/promises" {
|
|
|
1022
1103
|
function appendFile(
|
|
1023
1104
|
path: PathLike | FileHandle,
|
|
1024
1105
|
data: string | Uint8Array,
|
|
1025
|
-
options?: (ObjectEncodingOptions & FlagAndOpenMode) | BufferEncoding | null,
|
|
1106
|
+
options?: (ObjectEncodingOptions & FlagAndOpenMode & { flush?: boolean | undefined }) | BufferEncoding | null,
|
|
1026
1107
|
): Promise<void>;
|
|
1027
1108
|
/**
|
|
1028
1109
|
* Asynchronously reads the entire contents of a file.
|
|
@@ -1088,7 +1169,7 @@ declare module "fs/promises" {
|
|
|
1088
1169
|
flag?: OpenMode | undefined;
|
|
1089
1170
|
} & Abortable)
|
|
1090
1171
|
| null,
|
|
1091
|
-
): Promise<
|
|
1172
|
+
): Promise<NonSharedBuffer>;
|
|
1092
1173
|
/**
|
|
1093
1174
|
* Asynchronously reads the entire contents of a file.
|
|
1094
1175
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -1124,7 +1205,7 @@ declare module "fs/promises" {
|
|
|
1124
1205
|
)
|
|
1125
1206
|
| BufferEncoding
|
|
1126
1207
|
| null,
|
|
1127
|
-
): Promise<string |
|
|
1208
|
+
): Promise<string | NonSharedBuffer>;
|
|
1128
1209
|
/**
|
|
1129
1210
|
* Asynchronously open a directory for iterative scanning. See the POSIX [`opendir(3)`](http://man7.org/linux/man-pages/man3/opendir.3.html) documentation for more detail.
|
|
1130
1211
|
*
|
|
@@ -1154,11 +1235,21 @@ declare module "fs/promises" {
|
|
|
1154
1235
|
* @return Fulfills with an {fs.Dir}.
|
|
1155
1236
|
*/
|
|
1156
1237
|
function opendir(path: PathLike, options?: OpenDirOptions): Promise<Dir>;
|
|
1238
|
+
interface WatchOptions extends _WatchOptions {
|
|
1239
|
+
maxQueue?: number | undefined;
|
|
1240
|
+
overflow?: "ignore" | "throw" | undefined;
|
|
1241
|
+
}
|
|
1242
|
+
interface WatchOptionsWithBufferEncoding extends WatchOptions {
|
|
1243
|
+
encoding: "buffer";
|
|
1244
|
+
}
|
|
1245
|
+
interface WatchOptionsWithStringEncoding extends WatchOptions {
|
|
1246
|
+
encoding?: BufferEncoding | undefined;
|
|
1247
|
+
}
|
|
1157
1248
|
/**
|
|
1158
1249
|
* Returns an async iterator that watches for changes on `filename`, where `filename`is either a file or a directory.
|
|
1159
1250
|
*
|
|
1160
1251
|
* ```js
|
|
1161
|
-
*
|
|
1252
|
+
* import { watch } from 'node:fs/promises';
|
|
1162
1253
|
*
|
|
1163
1254
|
* const ac = new AbortController();
|
|
1164
1255
|
* const { signal } = ac;
|
|
@@ -1186,33 +1277,16 @@ declare module "fs/promises" {
|
|
|
1186
1277
|
*/
|
|
1187
1278
|
function watch(
|
|
1188
1279
|
filename: PathLike,
|
|
1189
|
-
options
|
|
1190
|
-
|
|
1191
|
-
encoding: "buffer";
|
|
1192
|
-
})
|
|
1193
|
-
| "buffer",
|
|
1194
|
-
): AsyncIterable<FileChangeInfo<Buffer>>;
|
|
1195
|
-
/**
|
|
1196
|
-
* Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
|
|
1197
|
-
* @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
|
|
1198
|
-
* @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options.
|
|
1199
|
-
* If `encoding` is not supplied, the default of `'utf8'` is used.
|
|
1200
|
-
* If `persistent` is not supplied, the default of `true` is used.
|
|
1201
|
-
* If `recursive` is not supplied, the default of `false` is used.
|
|
1202
|
-
*/
|
|
1203
|
-
function watch(filename: PathLike, options?: WatchOptions | BufferEncoding): AsyncIterable<FileChangeInfo<string>>;
|
|
1204
|
-
/**
|
|
1205
|
-
* Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
|
|
1206
|
-
* @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
|
|
1207
|
-
* @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options.
|
|
1208
|
-
* If `encoding` is not supplied, the default of `'utf8'` is used.
|
|
1209
|
-
* If `persistent` is not supplied, the default of `true` is used.
|
|
1210
|
-
* If `recursive` is not supplied, the default of `false` is used.
|
|
1211
|
-
*/
|
|
1280
|
+
options?: WatchOptionsWithStringEncoding | BufferEncoding,
|
|
1281
|
+
): NodeJS.AsyncIterator<FileChangeInfo<string>>;
|
|
1212
1282
|
function watch(
|
|
1213
1283
|
filename: PathLike,
|
|
1214
|
-
options:
|
|
1215
|
-
):
|
|
1284
|
+
options: WatchOptionsWithBufferEncoding | "buffer",
|
|
1285
|
+
): NodeJS.AsyncIterator<FileChangeInfo<NonSharedBuffer>>;
|
|
1286
|
+
function watch(
|
|
1287
|
+
filename: PathLike,
|
|
1288
|
+
options: WatchOptions | BufferEncoding | "buffer",
|
|
1289
|
+
): NodeJS.AsyncIterator<FileChangeInfo<string | NonSharedBuffer>>;
|
|
1216
1290
|
/**
|
|
1217
1291
|
* Asynchronously copies the entire directory structure from `src` to `dest`,
|
|
1218
1292
|
* including subdirectories and files.
|
|
@@ -1226,6 +1300,30 @@ declare module "fs/promises" {
|
|
|
1226
1300
|
* @return Fulfills with `undefined` upon success.
|
|
1227
1301
|
*/
|
|
1228
1302
|
function cp(source: string | URL, destination: string | URL, opts?: CopyOptions): Promise<void>;
|
|
1303
|
+
/**
|
|
1304
|
+
* ```js
|
|
1305
|
+
* import { glob } from 'node:fs/promises';
|
|
1306
|
+
*
|
|
1307
|
+
* for await (const entry of glob('*.js'))
|
|
1308
|
+
* console.log(entry);
|
|
1309
|
+
* ```
|
|
1310
|
+
* @since v22.0.0
|
|
1311
|
+
* @returns An AsyncIterator that yields the paths of files
|
|
1312
|
+
* that match the pattern.
|
|
1313
|
+
*/
|
|
1314
|
+
function glob(pattern: string | readonly string[]): NodeJS.AsyncIterator<string>;
|
|
1315
|
+
function glob(
|
|
1316
|
+
pattern: string | readonly string[],
|
|
1317
|
+
options: GlobOptionsWithFileTypes,
|
|
1318
|
+
): NodeJS.AsyncIterator<Dirent>;
|
|
1319
|
+
function glob(
|
|
1320
|
+
pattern: string | readonly string[],
|
|
1321
|
+
options: GlobOptionsWithoutFileTypes,
|
|
1322
|
+
): NodeJS.AsyncIterator<string>;
|
|
1323
|
+
function glob(
|
|
1324
|
+
pattern: string | readonly string[],
|
|
1325
|
+
options: GlobOptions,
|
|
1326
|
+
): NodeJS.AsyncIterator<Dirent | string>;
|
|
1229
1327
|
}
|
|
1230
1328
|
declare module "node:fs/promises" {
|
|
1231
1329
|
export * from "fs/promises";
|