@types/node 20.12.7 → 20.12.8
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 +41 -44
- node/async_hooks.d.ts +17 -15
- node/buffer.d.ts +7 -7
- node/child_process.d.ts +1 -1
- node/cluster.d.ts +1 -1
- node/console.d.ts +1 -1
- node/crypto.d.ts +38 -3
- node/dgram.d.ts +13 -13
- node/diagnostics_channel.d.ts +3 -3
- node/dns.d.ts +1 -1
- node/domain.d.ts +4 -4
- node/events.d.ts +25 -23
- node/fs/promises.d.ts +12 -12
- node/fs.d.ts +37 -37
- node/http.d.ts +4 -4
- node/http2.d.ts +77 -47
- node/https.d.ts +1 -1
- node/inspector.d.ts +4 -4
- node/net.d.ts +50 -8
- node/os.d.ts +28 -11
- node/package.json +2 -2
- node/path.d.ts +1 -1
- node/perf_hooks.d.ts +3 -3
- node/process.d.ts +214 -43
- node/punycode.d.ts +4 -4
- node/querystring.d.ts +18 -6
- node/readline/promises.d.ts +9 -9
- node/readline.d.ts +21 -20
- node/repl.d.ts +7 -7
- node/stream/web.d.ts +2 -2
- node/stream.d.ts +8 -6
- node/string_decoder.d.ts +3 -3
- node/test.d.ts +25 -23
- node/timers/promises.d.ts +10 -6
- node/timers.d.ts +5 -5
- node/tls.d.ts +39 -32
- node/trace_events.d.ts +40 -25
- node/tty.d.ts +8 -8
- node/url.d.ts +5 -5
- node/util.d.ts +115 -22
- node/v8.d.ts +6 -6
- node/vm.d.ts +35 -17
- node/wasi.d.ts +1 -1
- node/worker_threads.d.ts +16 -16
- node/zlib.d.ts +16 -3
node/diagnostics_channel.d.ts
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* should generally include the module name to avoid collisions with data from
|
|
21
21
|
* other modules.
|
|
22
22
|
* @since v15.1.0, v14.17.0
|
|
23
|
-
* @see [source](https://github.com/nodejs/node/blob/v20.2
|
|
23
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.12.2/lib/diagnostics_channel.js)
|
|
24
24
|
*/
|
|
25
25
|
declare module "diagnostics_channel" {
|
|
26
26
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
@@ -98,7 +98,7 @@ declare module "diagnostics_channel" {
|
|
|
98
98
|
function unsubscribe(name: string | symbol, onMessage: ChannelListener): boolean;
|
|
99
99
|
/**
|
|
100
100
|
* Creates a `TracingChannel` wrapper for the given `TracingChannel Channels`. If a name is given, the corresponding tracing
|
|
101
|
-
* channels will be created in the form of `tracing:${name}:${eventType}` where`eventType` corresponds to the types of `TracingChannel Channels`.
|
|
101
|
+
* channels will be created in the form of `tracing:${name}:${eventType}` where `eventType` corresponds to the types of `TracingChannel Channels`.
|
|
102
102
|
*
|
|
103
103
|
* ```js
|
|
104
104
|
* import diagnostics_channel from 'node:diagnostics_channel';
|
|
@@ -335,7 +335,7 @@ declare module "diagnostics_channel" {
|
|
|
335
335
|
/**
|
|
336
336
|
* The class `TracingChannel` is a collection of `TracingChannel Channels` which
|
|
337
337
|
* together express a single traceable action. It is used to formalize and
|
|
338
|
-
* simplify the process of producing events for tracing application flow.{@link tracingChannel} is used to construct a`TracingChannel`. As with `Channel` it is recommended to create and reuse a
|
|
338
|
+
* simplify the process of producing events for tracing application flow. {@link tracingChannel} is used to construct a `TracingChannel`. As with `Channel` it is recommended to create and reuse a
|
|
339
339
|
* single `TracingChannel` at the top-level of the file rather than creating them
|
|
340
340
|
* dynamically.
|
|
341
341
|
* @since v19.9.0
|
node/dns.d.ts
CHANGED
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
* ```
|
|
43
43
|
*
|
|
44
44
|
* See the [Implementation considerations section](https://nodejs.org/docs/latest-v20.x/api/dns.html#implementation-considerations) for more information.
|
|
45
|
-
* @see [source](https://github.com/nodejs/node/blob/v20.
|
|
45
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.12.2/lib/dns.js)
|
|
46
46
|
*/
|
|
47
47
|
declare module "dns" {
|
|
48
48
|
import * as dnsPromises from "node:dns/promises";
|
node/domain.d.ts
CHANGED
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
* Domains provide a way to handle multiple different IO operations as a
|
|
10
10
|
* single group. If any of the event emitters or callbacks registered to a
|
|
11
11
|
* domain emit an `'error'` event, or throw an error, then the domain object
|
|
12
|
-
* will be notified, rather than losing the context of the error in the`process.on('uncaughtException')` handler, or causing the program to
|
|
12
|
+
* will be notified, rather than losing the context of the error in the `process.on('uncaughtException')` handler, or causing the program to
|
|
13
13
|
* exit immediately with an error code.
|
|
14
14
|
* @deprecated Since v1.4.2 - Deprecated
|
|
15
|
-
* @see [source](https://github.com/nodejs/node/blob/v20.2
|
|
15
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.12.2/lib/domain.js)
|
|
16
16
|
*/
|
|
17
17
|
declare module "domain" {
|
|
18
18
|
import EventEmitter = require("node:events");
|
|
@@ -29,7 +29,7 @@ declare module "domain" {
|
|
|
29
29
|
*/
|
|
30
30
|
members: Array<EventEmitter | NodeJS.Timer>;
|
|
31
31
|
/**
|
|
32
|
-
* The `enter()` method is plumbing used by the `run()`, `bind()`, and`intercept()` methods to set the active domain. It sets `domain.active` and`process.domain` to the domain, and implicitly
|
|
32
|
+
* The `enter()` method is plumbing used by the `run()`, `bind()`, and `intercept()` methods to set the active domain. It sets `domain.active` and `process.domain` to the domain, and implicitly
|
|
33
33
|
* pushes the domain onto the domain
|
|
34
34
|
* stack managed by the domain module (see {@link exit} for details on the
|
|
35
35
|
* domain stack). The call to `enter()` delimits the beginning of a chain of
|
|
@@ -47,7 +47,7 @@ declare module "domain" {
|
|
|
47
47
|
* The call to `exit()` delimits either the end of or an interruption to the chain
|
|
48
48
|
* of asynchronous calls and I/O operations bound to a domain.
|
|
49
49
|
*
|
|
50
|
-
* If there are multiple, nested domains bound to the current execution context
|
|
50
|
+
* If there are multiple, nested domains bound to the current execution context, `exit()` will exit any domains nested within this domain.
|
|
51
51
|
*
|
|
52
52
|
* Calling `exit()` changes only the active domain, and does not alter the domain
|
|
53
53
|
* itself. `enter()` and `exit()` can be called an arbitrary number of times on a
|
node/events.d.ts
CHANGED
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
* });
|
|
33
33
|
* myEmitter.emit('event');
|
|
34
34
|
* ```
|
|
35
|
-
* @see [source](https://github.com/nodejs/node/blob/v20.2
|
|
35
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.12.2/lib/events.js)
|
|
36
36
|
*/
|
|
37
37
|
declare module "events" {
|
|
38
38
|
import { AsyncResource, AsyncResourceOptions } from "node:async_hooks";
|
|
@@ -158,7 +158,7 @@ declare module "events" {
|
|
|
158
158
|
* }
|
|
159
159
|
* ```
|
|
160
160
|
*
|
|
161
|
-
* The special handling of the `'error'` event is only used when `events.once()`is used to wait for another event. If `events.once()` is used to wait for the
|
|
161
|
+
* The special handling of the `'error'` event is only used when `events.once()` is used to wait for another event. If `events.once()` is used to wait for the
|
|
162
162
|
* '`error'` event itself, then it is treated as any other kind of event without
|
|
163
163
|
* special handling:
|
|
164
164
|
*
|
|
@@ -266,7 +266,7 @@ declare module "events" {
|
|
|
266
266
|
* ```
|
|
267
267
|
* @since v13.6.0, v12.16.0
|
|
268
268
|
* @param eventName The name of the event being listened for
|
|
269
|
-
* @return that iterates `eventName` events emitted by the `emitter`
|
|
269
|
+
* @return An `AsyncIterator` that iterates `eventName` events emitted by the `emitter`
|
|
270
270
|
*/
|
|
271
271
|
static on(
|
|
272
272
|
emitter: NodeJS.EventEmitter,
|
|
@@ -274,7 +274,7 @@ declare module "events" {
|
|
|
274
274
|
options?: StaticEventEmitterOptions,
|
|
275
275
|
): AsyncIterableIterator<any>;
|
|
276
276
|
/**
|
|
277
|
-
* A class method that returns the number of listeners for the given `eventName`registered on the given `emitter`.
|
|
277
|
+
* A class method that returns the number of listeners for the given `eventName` registered on the given `emitter`.
|
|
278
278
|
*
|
|
279
279
|
* ```js
|
|
280
280
|
* import { EventEmitter, listenerCount } from 'node:events';
|
|
@@ -399,9 +399,9 @@ declare module "events" {
|
|
|
399
399
|
*/
|
|
400
400
|
static addAbortListener(signal: AbortSignal, resource: (event: Event) => void): Disposable;
|
|
401
401
|
/**
|
|
402
|
-
* This symbol shall be used to install a listener for only monitoring `'error'`events. Listeners installed using this symbol are called before the regular`'error'` listeners are called.
|
|
402
|
+
* This symbol shall be used to install a listener for only monitoring `'error'` events. Listeners installed using this symbol are called before the regular `'error'` listeners are called.
|
|
403
403
|
*
|
|
404
|
-
* Installing a listener using this symbol does not change the behavior once an`'error'` event is emitted. Therefore, the process will still crash if no
|
|
404
|
+
* Installing a listener using this symbol does not change the behavior once an `'error'` event is emitted. Therefore, the process will still crash if no
|
|
405
405
|
* regular `'error'` listener is installed.
|
|
406
406
|
* @since v13.6.0, v12.17.0
|
|
407
407
|
*/
|
|
@@ -424,16 +424,18 @@ declare module "events" {
|
|
|
424
424
|
* By default, a maximum of `10` listeners can be registered for any single
|
|
425
425
|
* event. This limit can be changed for individual `EventEmitter` instances
|
|
426
426
|
* using the `emitter.setMaxListeners(n)` method. To change the default
|
|
427
|
-
* for _all_`EventEmitter` instances, the `events.defaultMaxListeners`property
|
|
427
|
+
* for _all_`EventEmitter` instances, the `events.defaultMaxListeners` property
|
|
428
|
+
* can be used. If this value is not a positive number, a `RangeError` is thrown.
|
|
428
429
|
*
|
|
429
430
|
* Take caution when setting the `events.defaultMaxListeners` because the
|
|
430
|
-
* change affects _all_`EventEmitter` instances, including those created before
|
|
431
|
+
* change affects _all_ `EventEmitter` instances, including those created before
|
|
431
432
|
* the change is made. However, calling `emitter.setMaxListeners(n)` still has
|
|
432
433
|
* precedence over `events.defaultMaxListeners`.
|
|
433
434
|
*
|
|
434
435
|
* This is not a hard limit. The `EventEmitter` instance will allow
|
|
435
436
|
* more listeners to be added but will output a trace warning to stderr indicating
|
|
436
|
-
* that a "possible EventEmitter memory leak" has been detected. For any single
|
|
437
|
+
* that a "possible EventEmitter memory leak" has been detected. For any single
|
|
438
|
+
* `EventEmitter`, the `emitter.getMaxListeners()` and `emitter.setMaxListeners()` methods can be used to
|
|
437
439
|
* temporarily avoid this warning:
|
|
438
440
|
*
|
|
439
441
|
* ```js
|
|
@@ -557,10 +559,10 @@ declare module "events" {
|
|
|
557
559
|
*/
|
|
558
560
|
addListener<K>(eventName: Key<K, T>, listener: Listener1<K, T>): this;
|
|
559
561
|
/**
|
|
560
|
-
* Adds the `listener` function to the end of the listeners array for the
|
|
561
|
-
*
|
|
562
|
-
*
|
|
563
|
-
* times.
|
|
562
|
+
* Adds the `listener` function to the end of the listeners array for the event
|
|
563
|
+
* named `eventName`. No checks are made to see if the `listener` has already
|
|
564
|
+
* been added. Multiple calls passing the same combination of `eventName` and
|
|
565
|
+
* `listener` will result in the `listener` being added, and called, multiple times.
|
|
564
566
|
*
|
|
565
567
|
* ```js
|
|
566
568
|
* server.on('connection', (stream) => {
|
|
@@ -570,7 +572,7 @@ declare module "events" {
|
|
|
570
572
|
*
|
|
571
573
|
* Returns a reference to the `EventEmitter`, so that calls can be chained.
|
|
572
574
|
*
|
|
573
|
-
* By default, event listeners are invoked in the order they are added. The`emitter.prependListener()` method can be used as an alternative to add the
|
|
575
|
+
* By default, event listeners are invoked in the order they are added. The `emitter.prependListener()` method can be used as an alternative to add the
|
|
574
576
|
* event listener to the beginning of the listeners array.
|
|
575
577
|
*
|
|
576
578
|
* ```js
|
|
@@ -589,7 +591,7 @@ declare module "events" {
|
|
|
589
591
|
*/
|
|
590
592
|
on<K>(eventName: Key<K, T>, listener: Listener1<K, T>): this;
|
|
591
593
|
/**
|
|
592
|
-
* Adds a **one-time
|
|
594
|
+
* Adds a **one-time** `listener` function for the event named `eventName`. The
|
|
593
595
|
* next time `eventName` is triggered, this listener is removed and then invoked.
|
|
594
596
|
*
|
|
595
597
|
* ```js
|
|
@@ -600,7 +602,7 @@ declare module "events" {
|
|
|
600
602
|
*
|
|
601
603
|
* Returns a reference to the `EventEmitter`, so that calls can be chained.
|
|
602
604
|
*
|
|
603
|
-
* By default, event listeners are invoked in the order they are added. The`emitter.prependOnceListener()` method can be used as an alternative to add the
|
|
605
|
+
* By default, event listeners are invoked in the order they are added. The `emitter.prependOnceListener()` method can be used as an alternative to add the
|
|
604
606
|
* event listener to the beginning of the listeners array.
|
|
605
607
|
*
|
|
606
608
|
* ```js
|
|
@@ -619,7 +621,7 @@ declare module "events" {
|
|
|
619
621
|
*/
|
|
620
622
|
once<K>(eventName: Key<K, T>, listener: Listener1<K, T>): this;
|
|
621
623
|
/**
|
|
622
|
-
* Removes the specified `listener` from the listener array for the event named`eventName`.
|
|
624
|
+
* Removes the specified `listener` from the listener array for the event named `eventName`.
|
|
623
625
|
*
|
|
624
626
|
* ```js
|
|
625
627
|
* const callback = (stream) => {
|
|
@@ -636,7 +638,7 @@ declare module "events" {
|
|
|
636
638
|
* called multiple times to remove each instance.
|
|
637
639
|
*
|
|
638
640
|
* Once an event is emitted, all listeners attached to it at the
|
|
639
|
-
* time of emitting are called in order. This implies that any`removeListener()` or `removeAllListeners()` calls _after_ emitting and _before_ the last listener finishes execution
|
|
641
|
+
* time of emitting are called in order. This implies that any `removeListener()` or `removeAllListeners()` calls _after_ emitting and _before_ the last listener finishes execution
|
|
640
642
|
* will not remove them from`emit()` in progress. Subsequent events behave as expected.
|
|
641
643
|
*
|
|
642
644
|
* ```js
|
|
@@ -679,7 +681,7 @@ declare module "events" {
|
|
|
679
681
|
*
|
|
680
682
|
* When a single function has been added as a handler multiple times for a single
|
|
681
683
|
* event (as in the example below), `removeListener()` will remove the most
|
|
682
|
-
* recently added instance. In the example the `once('ping')`listener is removed:
|
|
684
|
+
* recently added instance. In the example the `once('ping')` listener is removed:
|
|
683
685
|
*
|
|
684
686
|
* ```js
|
|
685
687
|
* import { EventEmitter } from 'node:events';
|
|
@@ -721,7 +723,7 @@ declare module "events" {
|
|
|
721
723
|
* By default `EventEmitter`s will print a warning if more than `10` listeners are
|
|
722
724
|
* added for a particular event. This is a useful default that helps finding
|
|
723
725
|
* memory leaks. The `emitter.setMaxListeners()` method allows the limit to be
|
|
724
|
-
* modified for this specific `EventEmitter` instance. The value can be set to`Infinity` (or `0`) to indicate an unlimited number of listeners.
|
|
726
|
+
* modified for this specific `EventEmitter` instance. The value can be set to `Infinity` (or `0`) to indicate an unlimited number of listeners.
|
|
725
727
|
*
|
|
726
728
|
* Returns a reference to the `EventEmitter`, so that calls can be chained.
|
|
727
729
|
* @since v0.3.5
|
|
@@ -778,7 +780,7 @@ declare module "events" {
|
|
|
778
780
|
*/
|
|
779
781
|
rawListeners<K>(eventName: Key<K, T>): Array<Listener2<K, T>>;
|
|
780
782
|
/**
|
|
781
|
-
* Synchronously calls each of the listeners registered for the event named`eventName`, in the order they were registered, passing the supplied arguments
|
|
783
|
+
* Synchronously calls each of the listeners registered for the event named `eventName`, in the order they were registered, passing the supplied arguments
|
|
782
784
|
* to each.
|
|
783
785
|
*
|
|
784
786
|
* Returns `true` if the event had listeners, `false` otherwise.
|
|
@@ -830,8 +832,8 @@ declare module "events" {
|
|
|
830
832
|
/**
|
|
831
833
|
* Adds the `listener` function to the _beginning_ of the listeners array for the
|
|
832
834
|
* event named `eventName`. No checks are made to see if the `listener` has
|
|
833
|
-
* already been added. Multiple calls passing the same combination of `eventName`
|
|
834
|
-
* times.
|
|
835
|
+
* already been added. Multiple calls passing the same combination of `eventName`
|
|
836
|
+
* and `listener` will result in the `listener` being added, and called, multiple times.
|
|
835
837
|
*
|
|
836
838
|
* ```js
|
|
837
839
|
* server.prependListener('connection', (stream) => {
|
node/fs/promises.d.ts
CHANGED
|
@@ -189,7 +189,7 @@ declare module "fs/promises" {
|
|
|
189
189
|
* replacing it may require the `flags` `open` option to be set to `r+` rather than
|
|
190
190
|
* the default `r`. The `encoding` can be any one of those accepted by `Buffer`.
|
|
191
191
|
*
|
|
192
|
-
* If `autoClose` is set to true (default behavior) on `'error'` or `'finish'`the file descriptor will be closed automatically. If `autoClose` is false,
|
|
192
|
+
* If `autoClose` is set to true (default behavior) on `'error'` or `'finish'` the file descriptor will be closed automatically. If `autoClose` is false,
|
|
193
193
|
* then the file descriptor won't be closed, even if there's an error.
|
|
194
194
|
* It is the application's responsibility to close it and make sure there's no
|
|
195
195
|
* file descriptor leak.
|
|
@@ -268,7 +268,7 @@ declare module "fs/promises" {
|
|
|
268
268
|
*
|
|
269
269
|
* The `FileHandle` has to support reading.
|
|
270
270
|
*
|
|
271
|
-
* 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
|
|
271
|
+
* 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
|
|
272
272
|
* position till the end of the file. It doesn't always read from the beginning
|
|
273
273
|
* of the file.
|
|
274
274
|
* @since v10.0.0
|
|
@@ -375,7 +375,7 @@ declare module "fs/promises" {
|
|
|
375
375
|
*/
|
|
376
376
|
utimes(atime: TimeLike, mtime: TimeLike): Promise<void>;
|
|
377
377
|
/**
|
|
378
|
-
* Asynchronously writes data to a file, replacing the file if it already exists
|
|
378
|
+
* Asynchronously writes data to a file, replacing the file if it already exists. `data` can be a string, a buffer, an
|
|
379
379
|
* [AsyncIterable](https://tc39.github.io/ecma262/#sec-asynciterable-interface), or an
|
|
380
380
|
* [Iterable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#The_iterable_protocol) object.
|
|
381
381
|
* The promise is fulfilled with no arguments upon success.
|
|
@@ -485,7 +485,7 @@ declare module "fs/promises" {
|
|
|
485
485
|
/**
|
|
486
486
|
* Tests a user's permissions for the file or directory specified by `path`.
|
|
487
487
|
* The `mode` argument is an optional integer that specifies the accessibility
|
|
488
|
-
* 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
|
|
488
|
+
* 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`
|
|
489
489
|
* (e.g.`fs.constants.W_OK | fs.constants.R_OK`). Check `File access constants` for
|
|
490
490
|
* possible values of `mode`.
|
|
491
491
|
*
|
|
@@ -570,7 +570,7 @@ declare module "fs/promises" {
|
|
|
570
570
|
*/
|
|
571
571
|
function rename(oldPath: PathLike, newPath: PathLike): Promise<void>;
|
|
572
572
|
/**
|
|
573
|
-
* Truncates (shortens or extends the length) of the content at `path` to `len`bytes.
|
|
573
|
+
* Truncates (shortens or extends the length) of the content at `path` to `len` bytes.
|
|
574
574
|
* @since v10.0.0
|
|
575
575
|
* @param [len=0]
|
|
576
576
|
* @return Fulfills with `undefined` upon success.
|
|
@@ -580,7 +580,7 @@ declare module "fs/promises" {
|
|
|
580
580
|
* Removes the directory identified by `path`.
|
|
581
581
|
*
|
|
582
582
|
* Using `fsPromises.rmdir()` on a file (not a directory) results in the
|
|
583
|
-
* promise being rejected with an `ENOENT` error on Windows and an `ENOTDIR`error on POSIX.
|
|
583
|
+
* promise being rejected with an `ENOENT` error on Windows and an `ENOTDIR` error on POSIX.
|
|
584
584
|
*
|
|
585
585
|
* To get a behavior similar to the `rm -rf` Unix command, use `fsPromises.rm()` with options `{ recursive: true, force: true }`.
|
|
586
586
|
* @since v10.0.0
|
|
@@ -597,7 +597,7 @@ declare module "fs/promises" {
|
|
|
597
597
|
* Asynchronously creates a directory.
|
|
598
598
|
*
|
|
599
599
|
* The optional `options` argument can be an integer specifying `mode` (permission
|
|
600
|
-
* 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
|
|
600
|
+
* 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
|
|
601
601
|
* that exists results in a
|
|
602
602
|
* rejection only when `recursive` is false.
|
|
603
603
|
*
|
|
@@ -747,7 +747,7 @@ declare module "fs/promises" {
|
|
|
747
747
|
/**
|
|
748
748
|
* Creates a symbolic link.
|
|
749
749
|
*
|
|
750
|
-
* The `type` argument is only used on Windows platforms and can be one of `'dir'
|
|
750
|
+
* 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
|
|
751
751
|
* autodetect `target` type and use `'file'` or `'dir'`. If the `target` does not
|
|
752
752
|
* exist, `'file'` will be used. Windows junction points require the destination
|
|
753
753
|
* path to be absolute. When using `'junction'`, the `target` argument will
|
|
@@ -867,13 +867,13 @@ declare module "fs/promises" {
|
|
|
867
867
|
*
|
|
868
868
|
* * Values can be either numbers representing Unix epoch time, `Date`s, or a
|
|
869
869
|
* numeric string like `'123456789.0'`.
|
|
870
|
-
* * If the value can not be converted to a number, or is `NaN`, `Infinity`, or`-Infinity`, an `Error` will be thrown.
|
|
870
|
+
* * If the value can not be converted to a number, or is `NaN`, `Infinity`, or `-Infinity`, an `Error` will be thrown.
|
|
871
871
|
* @since v10.0.0
|
|
872
872
|
* @return Fulfills with `undefined` upon success.
|
|
873
873
|
*/
|
|
874
874
|
function utimes(path: PathLike, atime: TimeLike, mtime: TimeLike): Promise<void>;
|
|
875
875
|
/**
|
|
876
|
-
* Determines the actual location of `path` using the same semantics as the`fs.realpath.native()` function.
|
|
876
|
+
* Determines the actual location of `path` using the same semantics as the `fs.realpath.native()` function.
|
|
877
877
|
*
|
|
878
878
|
* Only paths that can be converted to UTF8 strings are supported.
|
|
879
879
|
*
|
|
@@ -927,7 +927,7 @@ declare module "fs/promises" {
|
|
|
927
927
|
* ```
|
|
928
928
|
*
|
|
929
929
|
* The `fsPromises.mkdtemp()` method will append the six randomly selected
|
|
930
|
-
* 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
|
|
930
|
+
* 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
|
|
931
931
|
* platform-specific path separator
|
|
932
932
|
* (`require('node:path').sep`).
|
|
933
933
|
* @since v10.0.0
|
|
@@ -947,7 +947,7 @@ declare module "fs/promises" {
|
|
|
947
947
|
*/
|
|
948
948
|
function mkdtemp(prefix: string, options?: ObjectEncodingOptions | BufferEncoding | null): Promise<string | Buffer>;
|
|
949
949
|
/**
|
|
950
|
-
* Asynchronously writes data to a file, replacing the file if it already exists
|
|
950
|
+
* Asynchronously writes data to a file, replacing the file if it already exists. `data` can be a string, a buffer, an
|
|
951
951
|
* [AsyncIterable](https://tc39.github.io/ecma262/#sec-asynciterable-interface), or an
|
|
952
952
|
* [Iterable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#The_iterable_protocol) object.
|
|
953
953
|
*
|
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/v20.2
|
|
19
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.12.2/lib/fs.js)
|
|
20
20
|
*/
|
|
21
21
|
declare module "fs" {
|
|
22
22
|
import * as stream from "node:stream";
|
|
@@ -1439,7 +1439,7 @@ declare module "fs" {
|
|
|
1439
1439
|
* 2. The maximum number of symbolic links is platform-independent and generally
|
|
1440
1440
|
* (much) higher than what the native [`realpath(3)`](http://man7.org/linux/man-pages/man3/realpath.3.html) implementation supports.
|
|
1441
1441
|
*
|
|
1442
|
-
* The `callback` gets two arguments `(err, resolvedPath)`. May use `process.cwd`to resolve relative paths.
|
|
1442
|
+
* The `callback` gets two arguments `(err, resolvedPath)`. May use `process.cwd` to resolve relative paths.
|
|
1443
1443
|
*
|
|
1444
1444
|
* Only paths that can be converted to UTF8 strings are supported.
|
|
1445
1445
|
*
|
|
@@ -1683,7 +1683,7 @@ declare module "fs" {
|
|
|
1683
1683
|
retryDelay?: number | undefined;
|
|
1684
1684
|
}
|
|
1685
1685
|
/**
|
|
1686
|
-
* Asynchronously removes files and directories (modeled on the standard POSIX `rm`utility). No arguments other than a possible exception are given to the
|
|
1686
|
+
* Asynchronously removes files and directories (modeled on the standard POSIX `rm` utility). No arguments other than a possible exception are given to the
|
|
1687
1687
|
* completion callback.
|
|
1688
1688
|
* @since v14.14.0
|
|
1689
1689
|
*/
|
|
@@ -1696,7 +1696,7 @@ declare module "fs" {
|
|
|
1696
1696
|
function __promisify__(path: PathLike, options?: RmOptions): Promise<void>;
|
|
1697
1697
|
}
|
|
1698
1698
|
/**
|
|
1699
|
-
* Synchronously removes files and directories (modeled on the standard POSIX `rm`utility). Returns `undefined`.
|
|
1699
|
+
* Synchronously removes files and directories (modeled on the standard POSIX `rm` utility). Returns `undefined`.
|
|
1700
1700
|
* @since v14.14.0
|
|
1701
1701
|
*/
|
|
1702
1702
|
export function rmSync(path: PathLike, options?: RmOptions): void;
|
|
@@ -1721,7 +1721,7 @@ declare module "fs" {
|
|
|
1721
1721
|
* created (for instance, if it was previously created).
|
|
1722
1722
|
*
|
|
1723
1723
|
* The optional `options` argument can be an integer specifying `mode` (permission
|
|
1724
|
-
* and sticky bits), or an object with a `mode` property and a `recursive`property indicating whether parent directories should be created. Calling`fs.mkdir()` when `path` is a directory that
|
|
1724
|
+
* and sticky bits), or an object with a `mode` property and a `recursive` property indicating whether parent directories should be created. Calling `fs.mkdir()` when `path` is a directory that
|
|
1725
1725
|
* exists results in an error only
|
|
1726
1726
|
* when `recursive` is false. If `recursive` is false and the directory exists,
|
|
1727
1727
|
* an `EEXIST` error occurs.
|
|
@@ -1829,7 +1829,7 @@ declare module "fs" {
|
|
|
1829
1829
|
): Promise<string | undefined>;
|
|
1830
1830
|
}
|
|
1831
1831
|
/**
|
|
1832
|
-
* Synchronously creates a directory. Returns `undefined`, or if `recursive` is`true`, the first directory path created.
|
|
1832
|
+
* Synchronously creates a directory. Returns `undefined`, or if `recursive` is `true`, the first directory path created.
|
|
1833
1833
|
* This is the synchronous version of {@link mkdir}.
|
|
1834
1834
|
*
|
|
1835
1835
|
* See the POSIX [`mkdir(2)`](http://man7.org/linux/man-pages/man2/mkdir.2.html) documentation for more details.
|
|
@@ -1866,7 +1866,7 @@ declare module "fs" {
|
|
|
1866
1866
|
/**
|
|
1867
1867
|
* Creates a unique temporary directory.
|
|
1868
1868
|
*
|
|
1869
|
-
* Generates six random characters to be appended behind a required`prefix` to create a unique temporary directory. Due to platform
|
|
1869
|
+
* Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory. Due to platform
|
|
1870
1870
|
* inconsistencies, avoid trailing `X` characters in `prefix`. Some platforms,
|
|
1871
1871
|
* notably the BSDs, can return more than six random characters, and replace
|
|
1872
1872
|
* trailing `X` characters in `prefix` with random characters.
|
|
@@ -2003,7 +2003,7 @@ declare module "fs" {
|
|
|
2003
2003
|
*/
|
|
2004
2004
|
export function mkdtempSync(prefix: string, options?: EncodingOption): string | Buffer;
|
|
2005
2005
|
/**
|
|
2006
|
-
* Reads the contents of a directory. The callback gets two arguments `(err, files)`where `files` is an array of the names of the files in the directory excluding`'.'` and `'..'`.
|
|
2006
|
+
* Reads the contents of a directory. The callback gets two arguments `(err, files)` where `files` is an array of the names of the files in the directory excluding `'.'` and `'..'`.
|
|
2007
2007
|
*
|
|
2008
2008
|
* See the POSIX [`readdir(3)`](http://man7.org/linux/man-pages/man3/readdir.3.html) documentation for more details.
|
|
2009
2009
|
*
|
|
@@ -2297,8 +2297,8 @@ declare module "fs" {
|
|
|
2297
2297
|
*
|
|
2298
2298
|
* The `atime` and `mtime` arguments follow these rules:
|
|
2299
2299
|
*
|
|
2300
|
-
* * Values can be either numbers representing Unix epoch time in seconds
|
|
2301
|
-
* * If the value can not be converted to a number, or is `NaN`, `Infinity`, or`-Infinity`, an `Error` will be thrown.
|
|
2300
|
+
* * Values can be either numbers representing Unix epoch time in seconds, `Date`s, or a numeric string like `'123456789.0'`.
|
|
2301
|
+
* * If the value can not be converted to a number, or is `NaN`, `Infinity`, or `-Infinity`, an `Error` will be thrown.
|
|
2302
2302
|
* @since v0.4.2
|
|
2303
2303
|
*/
|
|
2304
2304
|
export function utimes(path: PathLike, atime: TimeLike, mtime: TimeLike, callback: NoParamCallback): void;
|
|
@@ -2371,7 +2371,7 @@ declare module "fs" {
|
|
|
2371
2371
|
* should be written. If `typeof position !== 'number'`, the data will be written
|
|
2372
2372
|
* at the current position. See [`pwrite(2)`](http://man7.org/linux/man-pages/man2/pwrite.2.html).
|
|
2373
2373
|
*
|
|
2374
|
-
* The callback will be given three arguments `(err, bytesWritten, buffer)` where`bytesWritten` specifies how many _bytes_ were written from `buffer`.
|
|
2374
|
+
* The callback will be given three arguments `(err, bytesWritten, buffer)` where `bytesWritten` specifies how many _bytes_ were written from `buffer`.
|
|
2375
2375
|
*
|
|
2376
2376
|
* If this method is invoked as its `util.promisify()` ed version, it returns
|
|
2377
2377
|
* a promise for an `Object` with `bytesWritten` and `buffer` properties.
|
|
@@ -2820,7 +2820,7 @@ declare module "fs" {
|
|
|
2820
2820
|
* If the `encoding` option is specified then this function returns a
|
|
2821
2821
|
* string. Otherwise it returns a buffer.
|
|
2822
2822
|
*
|
|
2823
|
-
* Similar to {@link readFile}, when the path is a directory, the behavior of`fs.readFileSync()` is platform-specific.
|
|
2823
|
+
* Similar to {@link readFile}, when the path is a directory, the behavior of `fs.readFileSync()` is platform-specific.
|
|
2824
2824
|
*
|
|
2825
2825
|
* ```js
|
|
2826
2826
|
* import { readFileSync } from 'node:fs';
|
|
@@ -2890,7 +2890,7 @@ declare module "fs" {
|
|
|
2890
2890
|
* When `file` is a filename, asynchronously writes data to the file, replacing the
|
|
2891
2891
|
* file if it already exists. `data` can be a string or a buffer.
|
|
2892
2892
|
*
|
|
2893
|
-
* When `file` is a file descriptor, the behavior is similar to calling`fs.write()` directly (which is recommended). See the notes below on using
|
|
2893
|
+
* When `file` is a file descriptor, the behavior is similar to calling `fs.write()` directly (which is recommended). See the notes below on using
|
|
2894
2894
|
* a file descriptor.
|
|
2895
2895
|
*
|
|
2896
2896
|
* The `encoding` option is ignored if `data` is a buffer.
|
|
@@ -3139,7 +3139,7 @@ declare module "fs" {
|
|
|
3139
3139
|
* Watch for changes on `filename`. The callback `listener` will be called each
|
|
3140
3140
|
* time the file is accessed.
|
|
3141
3141
|
*
|
|
3142
|
-
* The `options` argument may be omitted. If provided, it should be an object. The`options` object may contain a boolean named `persistent` that indicates
|
|
3142
|
+
* The `options` argument may be omitted. If provided, it should be an object. The `options` object may contain a boolean named `persistent` that indicates
|
|
3143
3143
|
* whether the process should continue to run as long as files are being watched.
|
|
3144
3144
|
* The `options` object may specify an `interval` property indicating how often the
|
|
3145
3145
|
* target should be polled in milliseconds.
|
|
@@ -3168,7 +3168,7 @@ declare module "fs" {
|
|
|
3168
3168
|
* again, with the latest stat objects. This is a change in functionality since
|
|
3169
3169
|
* v0.10.
|
|
3170
3170
|
*
|
|
3171
|
-
* Using {@link watch} is more efficient than `fs.watchFile` and`fs.unwatchFile`. `fs.watch` should be used instead of `fs.watchFile` and`fs.unwatchFile` when possible.
|
|
3171
|
+
* Using {@link watch} is more efficient than `fs.watchFile` and `fs.unwatchFile`. `fs.watch` should be used instead of `fs.watchFile` and `fs.unwatchFile` when possible.
|
|
3172
3172
|
*
|
|
3173
3173
|
* When a file being watched by `fs.watchFile()` disappears and reappears,
|
|
3174
3174
|
* then the contents of `previous` in the second callback event (the file's
|
|
@@ -3190,7 +3190,7 @@ declare module "fs" {
|
|
|
3190
3190
|
* Watch for changes on `filename`. The callback `listener` will be called each
|
|
3191
3191
|
* time the file is accessed.
|
|
3192
3192
|
*
|
|
3193
|
-
* The `options` argument may be omitted. If provided, it should be an object. The`options` object may contain a boolean named `persistent` that indicates
|
|
3193
|
+
* The `options` argument may be omitted. If provided, it should be an object. The `options` object may contain a boolean named `persistent` that indicates
|
|
3194
3194
|
* whether the process should continue to run as long as files are being watched.
|
|
3195
3195
|
* The `options` object may specify an `interval` property indicating how often the
|
|
3196
3196
|
* target should be polled in milliseconds.
|
|
@@ -3219,7 +3219,7 @@ declare module "fs" {
|
|
|
3219
3219
|
* again, with the latest stat objects. This is a change in functionality since
|
|
3220
3220
|
* v0.10.
|
|
3221
3221
|
*
|
|
3222
|
-
* Using {@link watch} is more efficient than `fs.watchFile` and`fs.unwatchFile`. `fs.watch` should be used instead of `fs.watchFile` and`fs.unwatchFile` when possible.
|
|
3222
|
+
* Using {@link watch} is more efficient than `fs.watchFile` and `fs.unwatchFile`. `fs.watch` should be used instead of `fs.watchFile` and `fs.unwatchFile` when possible.
|
|
3223
3223
|
*
|
|
3224
3224
|
* When a file being watched by `fs.watchFile()` disappears and reappears,
|
|
3225
3225
|
* then the contents of `previous` in the second callback event (the file's
|
|
@@ -3263,7 +3263,7 @@ declare module "fs" {
|
|
|
3263
3263
|
* Calling `fs.unwatchFile()` with a filename that is not being watched is a
|
|
3264
3264
|
* no-op, not an error.
|
|
3265
3265
|
*
|
|
3266
|
-
* Using {@link watch} is more efficient than `fs.watchFile()` and`fs.unwatchFile()`. `fs.watch()` should be used instead of `fs.watchFile()`and `fs.unwatchFile()` when possible.
|
|
3266
|
+
* Using {@link watch} is more efficient than `fs.watchFile()` and `fs.unwatchFile()`. `fs.watch()` should be used instead of `fs.watchFile()` and `fs.unwatchFile()` when possible.
|
|
3267
3267
|
* @since v0.1.31
|
|
3268
3268
|
* @param listener Optional, a listener previously attached using `fs.watchFile()`
|
|
3269
3269
|
*/
|
|
@@ -3291,7 +3291,7 @@ declare module "fs" {
|
|
|
3291
3291
|
* On most platforms, `'rename'` is emitted whenever a filename appears or
|
|
3292
3292
|
* disappears in the directory.
|
|
3293
3293
|
*
|
|
3294
|
-
* 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`.
|
|
3294
|
+
* 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`.
|
|
3295
3295
|
*
|
|
3296
3296
|
* If a `signal` is passed, aborting the corresponding AbortController will close
|
|
3297
3297
|
* the returned `fs.FSWatcher`.
|
|
@@ -3351,11 +3351,11 @@ declare module "fs" {
|
|
|
3351
3351
|
* ```
|
|
3352
3352
|
*
|
|
3353
3353
|
* **The parameters for this callback are not consistent with other Node.js**
|
|
3354
|
-
* **callbacks.** Normally, the first parameter to a Node.js callback is an `err`parameter, optionally followed by other parameters. The `fs.exists()` callback
|
|
3354
|
+
* **callbacks.** Normally, the first parameter to a Node.js callback is an `err` parameter, optionally followed by other parameters. The `fs.exists()` callback
|
|
3355
3355
|
* has only one boolean parameter. This is one reason `fs.access()` is recommended
|
|
3356
3356
|
* instead of `fs.exists()`.
|
|
3357
3357
|
*
|
|
3358
|
-
* Using `fs.exists()` to check for the existence of a file before calling`fs.open()`, `fs.readFile()`, or `fs.writeFile()` is not recommended. Doing
|
|
3358
|
+
* Using `fs.exists()` to check for the existence of a file before calling `fs.open()`, `fs.readFile()`, or `fs.writeFile()` is not recommended. Doing
|
|
3359
3359
|
* so introduces a race condition, since other processes may change the file's
|
|
3360
3360
|
* state between the two calls. Instead, user code should open/read/write the
|
|
3361
3361
|
* file directly and handle the error raised if the file does not exist.
|
|
@@ -3482,7 +3482,7 @@ declare module "fs" {
|
|
|
3482
3482
|
* For detailed information, see the documentation of the asynchronous version of
|
|
3483
3483
|
* this API: {@link exists}.
|
|
3484
3484
|
*
|
|
3485
|
-
* `fs.exists()` is deprecated, but `fs.existsSync()` is not. The `callback`parameter to `fs.exists()` accepts parameters that are inconsistent with other
|
|
3485
|
+
* `fs.exists()` is deprecated, but `fs.existsSync()` is not. The `callback` parameter to `fs.exists()` accepts parameters that are inconsistent with other
|
|
3486
3486
|
* Node.js callbacks. `fs.existsSync()` does not use a callback.
|
|
3487
3487
|
*
|
|
3488
3488
|
* ```js
|
|
@@ -3611,13 +3611,13 @@ declare module "fs" {
|
|
|
3611
3611
|
/**
|
|
3612
3612
|
* Tests a user's permissions for the file or directory specified by `path`.
|
|
3613
3613
|
* The `mode` argument is an optional integer that specifies the accessibility
|
|
3614
|
-
* 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
|
|
3614
|
+
* 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`
|
|
3615
3615
|
* (e.g.`fs.constants.W_OK | fs.constants.R_OK`). Check `File access constants` for
|
|
3616
3616
|
* possible values of `mode`.
|
|
3617
3617
|
*
|
|
3618
3618
|
* The final argument, `callback`, is a callback function that is invoked with
|
|
3619
3619
|
* a possible error argument. If any of the accessibility checks fail, the error
|
|
3620
|
-
* argument will be an `Error` object. The following examples check if`package.json` exists, and if it is readable or writable.
|
|
3620
|
+
* argument will be an `Error` object. The following examples check if `package.json` exists, and if it is readable or writable.
|
|
3621
3621
|
*
|
|
3622
3622
|
* ```js
|
|
3623
3623
|
* import { access, constants } from 'node:fs';
|
|
@@ -3645,7 +3645,7 @@ declare module "fs" {
|
|
|
3645
3645
|
* });
|
|
3646
3646
|
* ```
|
|
3647
3647
|
*
|
|
3648
|
-
* Do not use `fs.access()` to check for the accessibility of a file before calling`fs.open()`, `fs.readFile()`, or `fs.writeFile()`. Doing
|
|
3648
|
+
* Do not use `fs.access()` to check for the accessibility of a file before calling `fs.open()`, `fs.readFile()`, or `fs.writeFile()`. Doing
|
|
3649
3649
|
* so introduces a race condition, since other processes may change the file's
|
|
3650
3650
|
* state between the two calls. Instead, user code should open/read/write the
|
|
3651
3651
|
* file directly and handle the error raised if the file is not accessible.
|
|
@@ -3785,7 +3785,7 @@ declare module "fs" {
|
|
|
3785
3785
|
/**
|
|
3786
3786
|
* Synchronously tests a user's permissions for the file or directory specified
|
|
3787
3787
|
* by `path`. The `mode` argument is an optional integer that specifies the
|
|
3788
|
-
* accessibility 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
|
|
3788
|
+
* accessibility 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
|
|
3789
3789
|
* `fs.constants.X_OK` (e.g.`fs.constants.W_OK | fs.constants.R_OK`). Check `File access constants` for
|
|
3790
3790
|
* possible values of `mode`.
|
|
3791
3791
|
*
|
|
@@ -3859,8 +3859,8 @@ declare module "fs" {
|
|
|
3859
3859
|
* By default, the stream will emit a `'close'` event after it has been
|
|
3860
3860
|
* destroyed. Set the `emitClose` option to `false` to change this behavior.
|
|
3861
3861
|
*
|
|
3862
|
-
* By providing the `fs` option, it is possible to override the corresponding `fs`implementations for `open`, `read`, and `close`. When providing the `fs` option,
|
|
3863
|
-
* an override for `read` is required. If no `fd` is provided, an override for`open` is also required. If `autoClose` is `true`, an override for `close` is
|
|
3862
|
+
* By providing the `fs` option, it is possible to override the corresponding `fs` implementations for `open`, `read`, and `close`. When providing the `fs` option,
|
|
3863
|
+
* an override for `read` is required. If no `fd` is provided, an override for `open` is also required. If `autoClose` is `true`, an override for `close` is
|
|
3864
3864
|
* also required.
|
|
3865
3865
|
*
|
|
3866
3866
|
* ```js
|
|
@@ -3908,7 +3908,7 @@ declare module "fs" {
|
|
|
3908
3908
|
* replacing it may require the `flags` option to be set to `r+` rather than the
|
|
3909
3909
|
* default `w`. The `encoding` can be any one of those accepted by `Buffer`.
|
|
3910
3910
|
*
|
|
3911
|
-
* If `autoClose` is set to true (default behavior) on `'error'` or `'finish'`the file descriptor will be closed automatically. If `autoClose` is false,
|
|
3911
|
+
* If `autoClose` is set to true (default behavior) on `'error'` or `'finish'` the file descriptor will be closed automatically. If `autoClose` is false,
|
|
3912
3912
|
* then the file descriptor won't be closed, even if there's an error.
|
|
3913
3913
|
* It is the application's responsibility to close it and make sure there's no
|
|
3914
3914
|
* file descriptor leak.
|
|
@@ -3916,12 +3916,12 @@ declare module "fs" {
|
|
|
3916
3916
|
* By default, the stream will emit a `'close'` event after it has been
|
|
3917
3917
|
* destroyed. Set the `emitClose` option to `false` to change this behavior.
|
|
3918
3918
|
*
|
|
3919
|
-
* By providing the `fs` option it is possible to override the corresponding `fs`implementations for `open`, `write`, `writev`, and `close`. Overriding `write()`without `writev()` can reduce
|
|
3919
|
+
* By providing the `fs` option it is possible to override the corresponding `fs` implementations for `open`, `write`, `writev`, and `close`. Overriding `write()` without `writev()` can reduce
|
|
3920
3920
|
* performance as some optimizations (`_writev()`)
|
|
3921
|
-
* will be disabled. When providing the `fs` option, overrides for at least one of`write` and `writev` are required. If no `fd` option is supplied, an override
|
|
3922
|
-
* for `open` is also required. If `autoClose` is `true`, an override for `close`is also required.
|
|
3921
|
+
* will be disabled. When providing the `fs` option, overrides for at least one of `write` and `writev` are required. If no `fd` option is supplied, an override
|
|
3922
|
+
* for `open` is also required. If `autoClose` is `true`, an override for `close` is also required.
|
|
3923
3923
|
*
|
|
3924
|
-
* 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
|
|
3924
|
+
* 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
|
|
3925
3925
|
* emitted. `fd` should be blocking; non-blocking `fd`s
|
|
3926
3926
|
* should be passed to `net.Socket`.
|
|
3927
3927
|
*
|
|
@@ -4030,15 +4030,15 @@ declare module "fs" {
|
|
|
4030
4030
|
*/
|
|
4031
4031
|
export function copyFileSync(src: PathLike, dest: PathLike, mode?: number): void;
|
|
4032
4032
|
/**
|
|
4033
|
-
* Write an array of `ArrayBufferView`s to the file specified by `fd` using`writev()`.
|
|
4033
|
+
* Write an array of `ArrayBufferView`s to the file specified by `fd` using `writev()`.
|
|
4034
4034
|
*
|
|
4035
4035
|
* `position` is the offset from the beginning of the file where this data
|
|
4036
4036
|
* should be written. If `typeof position !== 'number'`, the data will be written
|
|
4037
4037
|
* at the current position.
|
|
4038
4038
|
*
|
|
4039
|
-
* The callback will be given three arguments: `err`, `bytesWritten`, and`buffers`. `bytesWritten` is how many bytes were written from `buffers`.
|
|
4039
|
+
* The callback will be given three arguments: `err`, `bytesWritten`, and `buffers`. `bytesWritten` is how many bytes were written from `buffers`.
|
|
4040
4040
|
*
|
|
4041
|
-
* If this method is `util.promisify()` ed, it returns a promise for an`Object` with `bytesWritten` and `buffers` properties.
|
|
4041
|
+
* If this method is `util.promisify()` ed, it returns a promise for an `Object` with `bytesWritten` and `buffers` properties.
|
|
4042
4042
|
*
|
|
4043
4043
|
* It is unsafe to use `fs.writev()` multiple times on the same file without
|
|
4044
4044
|
* waiting for the callback. For this scenario, use {@link createWriteStream}.
|
|
@@ -4087,7 +4087,7 @@ declare module "fs" {
|
|
|
4087
4087
|
* should be read. If `typeof position !== 'number'`, the data will be read
|
|
4088
4088
|
* from the current position.
|
|
4089
4089
|
*
|
|
4090
|
-
* The callback will be given three arguments: `err`, `bytesRead`, and`buffers`. `bytesRead` is how many bytes were read from the file.
|
|
4090
|
+
* The callback will be given three arguments: `err`, `bytesRead`, and `buffers`. `bytesRead` is how many bytes were read from the file.
|
|
4091
4091
|
*
|
|
4092
4092
|
* If this method is invoked as its `util.promisify()` ed version, it returns
|
|
4093
4093
|
* a promise for an `Object` with `bytesRead` and `buffers` properties.
|