omegon 0.8.4 → 0.9.1
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/extensions/cleave/dispatcher.ts +213 -20
- package/extensions/cleave/rpc-child.ts +269 -0
- package/extensions/cleave/types.ts +52 -0
- package/node_modules/@types/node/README.md +3 -3
- package/node_modules/@types/node/assert/strict.d.ts +11 -5
- package/node_modules/@types/node/assert.d.ts +173 -50
- package/node_modules/@types/node/async_hooks.d.ts +8 -28
- package/node_modules/@types/node/buffer.buffer.d.ts +7 -1
- package/node_modules/@types/node/buffer.d.ts +168 -44
- package/node_modules/@types/node/child_process.d.ts +70 -27
- package/node_modules/@types/node/cluster.d.ts +332 -240
- package/node_modules/@types/node/compatibility/disposable.d.ts +14 -0
- package/node_modules/@types/node/compatibility/index.d.ts +9 -0
- package/node_modules/@types/node/compatibility/indexable.d.ts +20 -0
- package/node_modules/@types/node/compatibility/iterators.d.ts +0 -1
- package/node_modules/@types/node/console.d.ts +350 -49
- package/node_modules/@types/node/constants.d.ts +4 -3
- package/node_modules/@types/node/crypto.d.ts +1110 -630
- package/node_modules/@types/node/dgram.d.ts +51 -15
- package/node_modules/@types/node/diagnostics_channel.d.ts +6 -4
- package/node_modules/@types/node/dns/promises.d.ts +4 -4
- package/node_modules/@types/node/dns.d.ts +133 -132
- package/node_modules/@types/node/domain.d.ts +17 -13
- package/node_modules/@types/node/events.d.ts +663 -734
- package/node_modules/@types/node/fs/promises.d.ts +9 -43
- package/node_modules/@types/node/fs.d.ts +411 -628
- package/node_modules/@types/node/globals.d.ts +30 -8
- package/node_modules/@types/node/globals.typedarray.d.ts +0 -63
- package/node_modules/@types/node/http.d.ts +265 -364
- package/node_modules/@types/node/http2.d.ts +715 -551
- package/node_modules/@types/node/https.d.ts +239 -65
- package/node_modules/@types/node/index.d.ts +6 -24
- package/node_modules/@types/node/inspector.d.ts +53 -69
- package/node_modules/@types/node/inspector.generated.d.ts +410 -759
- package/node_modules/@types/node/module.d.ts +186 -52
- package/node_modules/@types/node/net.d.ts +194 -70
- package/node_modules/@types/node/os.d.ts +11 -12
- package/node_modules/@types/node/package.json +3 -13
- package/node_modules/@types/node/path.d.ts +133 -120
- package/node_modules/@types/node/perf_hooks.d.ts +643 -318
- package/node_modules/@types/node/process.d.ts +132 -223
- package/node_modules/@types/node/punycode.d.ts +5 -5
- package/node_modules/@types/node/querystring.d.ts +4 -4
- package/node_modules/@types/node/readline/promises.d.ts +3 -3
- package/node_modules/@types/node/readline.d.ts +120 -68
- package/node_modules/@types/node/repl.d.ts +100 -87
- package/node_modules/@types/node/sea.d.ts +1 -10
- package/node_modules/@types/node/sqlite.d.ts +19 -363
- package/node_modules/@types/node/stream/consumers.d.ts +10 -10
- package/node_modules/@types/node/stream/promises.d.ts +15 -136
- package/node_modules/@types/node/stream/web.d.ts +502 -176
- package/node_modules/@types/node/stream.d.ts +475 -581
- package/node_modules/@types/node/string_decoder.d.ts +4 -4
- package/node_modules/@types/node/test.d.ts +196 -308
- package/node_modules/@types/node/timers/promises.d.ts +4 -4
- package/node_modules/@types/node/timers.d.ts +132 -4
- package/node_modules/@types/node/tls.d.ts +226 -110
- package/node_modules/@types/node/trace_events.d.ts +9 -9
- package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +7 -1
- package/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +0 -2
- package/node_modules/@types/node/ts5.6/index.d.ts +6 -26
- package/node_modules/@types/node/tty.d.ts +16 -58
- package/node_modules/@types/node/url.d.ts +573 -130
- package/node_modules/@types/node/util.d.ts +1100 -181
- package/node_modules/@types/node/v8.d.ts +8 -76
- package/node_modules/@types/node/vm.d.ts +72 -280
- package/node_modules/@types/node/wasi.d.ts +4 -25
- package/node_modules/@types/node/web-globals/abortcontroller.d.ts +2 -27
- package/node_modules/@types/node/web-globals/events.d.ts +0 -9
- package/node_modules/@types/node/web-globals/fetch.d.ts +0 -14
- package/node_modules/@types/node/web-globals/navigator.d.ts +0 -3
- package/node_modules/@types/node/worker_threads.d.ts +335 -268
- package/node_modules/@types/node/zlib.d.ts +74 -9
- package/node_modules/undici-types/agent.d.ts +12 -13
- package/node_modules/undici-types/api.d.ts +26 -26
- package/node_modules/undici-types/balanced-pool.d.ts +12 -13
- package/node_modules/undici-types/client.d.ts +19 -19
- package/node_modules/undici-types/connector.d.ts +2 -2
- package/node_modules/undici-types/cookies.d.ts +0 -2
- package/node_modules/undici-types/diagnostics-channel.d.ts +10 -18
- package/node_modules/undici-types/dispatcher.d.ts +103 -123
- package/node_modules/undici-types/env-http-proxy-agent.d.ts +3 -4
- package/node_modules/undici-types/errors.d.ts +54 -66
- package/node_modules/undici-types/eventsource.d.ts +4 -9
- package/node_modules/undici-types/fetch.d.ts +20 -22
- package/node_modules/undici-types/file.d.ts +39 -0
- package/node_modules/undici-types/filereader.d.ts +54 -0
- package/node_modules/undici-types/formdata.d.ts +7 -7
- 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/handlers.d.ts +8 -8
- package/node_modules/undici-types/header.d.ts +1 -157
- package/node_modules/undici-types/index.d.ts +47 -64
- package/node_modules/undici-types/interceptors.d.ts +8 -64
- package/node_modules/undici-types/mock-agent.d.ts +18 -36
- package/node_modules/undici-types/mock-client.d.ts +4 -6
- package/node_modules/undici-types/mock-errors.d.ts +3 -3
- package/node_modules/undici-types/mock-interceptor.d.ts +20 -21
- package/node_modules/undici-types/mock-pool.d.ts +4 -6
- package/node_modules/undici-types/package.json +1 -1
- package/node_modules/undici-types/patch.d.ts +4 -0
- package/node_modules/undici-types/pool-stats.d.ts +8 -8
- package/node_modules/undici-types/pool.d.ts +13 -15
- package/node_modules/undici-types/proxy-agent.d.ts +4 -5
- package/node_modules/undici-types/readable.d.ts +16 -19
- package/node_modules/undici-types/retry-agent.d.ts +1 -1
- package/node_modules/undici-types/retry-handler.d.ts +10 -19
- package/node_modules/undici-types/util.d.ts +3 -3
- package/node_modules/undici-types/webidl.d.ts +29 -142
- package/node_modules/undici-types/websocket.d.ts +10 -46
- package/package.json +2 -1
- package/scripts/check-vendor-dist.mjs +56 -0
- package/skills/cleave/SKILL.md +62 -2
- package/node_modules/@types/node/inspector/promises.d.ts +0 -41
- package/node_modules/@types/node/path/posix.d.ts +0 -8
- package/node_modules/@types/node/path/win32.d.ts +0 -8
- package/node_modules/@types/node/quic.d.ts +0 -910
- package/node_modules/@types/node/test/reporters.d.ts +0 -96
- package/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +0 -71
- package/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +0 -72
- package/node_modules/@types/node/ts5.7/index.d.ts +0 -117
- package/node_modules/@types/node/util/types.d.ts +0 -558
- package/node_modules/@types/node/web-globals/blob.d.ts +0 -23
- package/node_modules/@types/node/web-globals/console.d.ts +0 -9
- package/node_modules/@types/node/web-globals/crypto.d.ts +0 -39
- package/node_modules/@types/node/web-globals/encoding.d.ts +0 -11
- package/node_modules/@types/node/web-globals/importmeta.d.ts +0 -13
- package/node_modules/@types/node/web-globals/messaging.d.ts +0 -23
- package/node_modules/@types/node/web-globals/performance.d.ts +0 -45
- package/node_modules/@types/node/web-globals/streams.d.ts +0 -115
- package/node_modules/@types/node/web-globals/timers.d.ts +0 -44
- package/node_modules/@types/node/web-globals/url.d.ts +0 -24
- package/node_modules/undici-types/cache-interceptor.d.ts +0 -173
- package/node_modules/undici-types/client-stats.d.ts +0 -15
- package/node_modules/undici-types/h2c-client.d.ts +0 -73
- package/node_modules/undici-types/mock-call-history.d.ts +0 -111
- package/node_modules/undici-types/round-robin-pool.d.ts +0 -41
- package/node_modules/undici-types/snapshot-agent.d.ts +0 -109
- package/node_modules/undici-types/utility.d.ts +0 -7
|
@@ -16,33 +16,34 @@
|
|
|
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/
|
|
19
|
+
* @see [source](https://github.com/nodejs/node/blob/v22.x/lib/fs.js)
|
|
20
20
|
*/
|
|
21
|
-
declare module "
|
|
21
|
+
declare module "fs" {
|
|
22
22
|
import { NonSharedBuffer } from "node:buffer";
|
|
23
|
-
import { Abortable, EventEmitter, InternalEventEmitter } from "node:events";
|
|
24
|
-
import { FileHandle } from "node:fs/promises";
|
|
25
23
|
import * as stream from "node:stream";
|
|
24
|
+
import { Abortable, EventEmitter } from "node:events";
|
|
26
25
|
import { URL } from "node:url";
|
|
26
|
+
import * as promises from "node:fs/promises";
|
|
27
|
+
export { promises };
|
|
27
28
|
/**
|
|
28
29
|
* Valid types for path values in "fs".
|
|
29
30
|
*/
|
|
30
|
-
type PathLike = string | Buffer | URL;
|
|
31
|
-
type PathOrFileDescriptor = PathLike | number;
|
|
32
|
-
type TimeLike = string | number | Date;
|
|
33
|
-
type NoParamCallback = (err: NodeJS.ErrnoException | null) => void;
|
|
34
|
-
type BufferEncodingOption =
|
|
31
|
+
export type PathLike = string | Buffer | URL;
|
|
32
|
+
export type PathOrFileDescriptor = PathLike | number;
|
|
33
|
+
export type TimeLike = string | number | Date;
|
|
34
|
+
export type NoParamCallback = (err: NodeJS.ErrnoException | null) => void;
|
|
35
|
+
export type BufferEncodingOption =
|
|
35
36
|
| "buffer"
|
|
36
37
|
| {
|
|
37
38
|
encoding: "buffer";
|
|
38
39
|
};
|
|
39
|
-
interface ObjectEncodingOptions {
|
|
40
|
+
export interface ObjectEncodingOptions {
|
|
40
41
|
encoding?: BufferEncoding | null | undefined;
|
|
41
42
|
}
|
|
42
|
-
type EncodingOption = ObjectEncodingOptions | BufferEncoding | undefined | null;
|
|
43
|
-
type OpenMode = number | string;
|
|
44
|
-
type Mode = number | string;
|
|
45
|
-
interface StatsBase<T> {
|
|
43
|
+
export type EncodingOption = ObjectEncodingOptions | BufferEncoding | undefined | null;
|
|
44
|
+
export type OpenMode = number | string;
|
|
45
|
+
export type Mode = number | string;
|
|
46
|
+
export interface StatsBase<T> {
|
|
46
47
|
isFile(): boolean;
|
|
47
48
|
isDirectory(): boolean;
|
|
48
49
|
isBlockDevice(): boolean;
|
|
@@ -69,7 +70,7 @@ declare module "node:fs" {
|
|
|
69
70
|
ctime: Date;
|
|
70
71
|
birthtime: Date;
|
|
71
72
|
}
|
|
72
|
-
interface Stats extends StatsBase<number> {}
|
|
73
|
+
export interface Stats extends StatsBase<number> {}
|
|
73
74
|
/**
|
|
74
75
|
* A `fs.Stats` object provides information about a file.
|
|
75
76
|
*
|
|
@@ -130,10 +131,10 @@ declare module "node:fs" {
|
|
|
130
131
|
* ```
|
|
131
132
|
* @since v0.1.21
|
|
132
133
|
*/
|
|
133
|
-
class Stats {
|
|
134
|
+
export class Stats {
|
|
134
135
|
private constructor();
|
|
135
136
|
}
|
|
136
|
-
interface StatsFsBase<T> {
|
|
137
|
+
export interface StatsFsBase<T> {
|
|
137
138
|
/** Type of file system. */
|
|
138
139
|
type: T;
|
|
139
140
|
/** Optimal transfer block size. */
|
|
@@ -149,7 +150,7 @@ declare module "node:fs" {
|
|
|
149
150
|
/** Free file nodes in file system. */
|
|
150
151
|
ffree: T;
|
|
151
152
|
}
|
|
152
|
-
interface StatsFs extends StatsFsBase<number> {}
|
|
153
|
+
export interface StatsFs extends StatsFsBase<number> {}
|
|
153
154
|
/**
|
|
154
155
|
* Provides information about a mounted file system.
|
|
155
156
|
*
|
|
@@ -184,9 +185,9 @@ declare module "node:fs" {
|
|
|
184
185
|
* ```
|
|
185
186
|
* @since v19.6.0, v18.15.0
|
|
186
187
|
*/
|
|
187
|
-
class StatsFs {}
|
|
188
|
-
interface BigIntStatsFs extends StatsFsBase<bigint> {}
|
|
189
|
-
interface StatFsOptions {
|
|
188
|
+
export class StatsFs {}
|
|
189
|
+
export interface BigIntStatsFs extends StatsFsBase<bigint> {}
|
|
190
|
+
export interface StatFsOptions {
|
|
190
191
|
bigint?: boolean | undefined;
|
|
191
192
|
}
|
|
192
193
|
/**
|
|
@@ -198,7 +199,7 @@ declare module "node:fs" {
|
|
|
198
199
|
* the `withFileTypes` option set to `true`, the resulting array is filled with `fs.Dirent` objects, rather than strings or `Buffer` s.
|
|
199
200
|
* @since v10.10.0
|
|
200
201
|
*/
|
|
201
|
-
class Dirent<Name extends string | Buffer = string> {
|
|
202
|
+
export class Dirent<Name extends string | Buffer = string> {
|
|
202
203
|
/**
|
|
203
204
|
* Returns `true` if the `fs.Dirent` object describes a regular file.
|
|
204
205
|
* @since v10.10.0
|
|
@@ -247,6 +248,12 @@ declare module "node:fs" {
|
|
|
247
248
|
* @since v20.12.0, v18.20.0
|
|
248
249
|
*/
|
|
249
250
|
parentPath: string;
|
|
251
|
+
/**
|
|
252
|
+
* Alias for `dirent.parentPath`.
|
|
253
|
+
* @since v20.1.0
|
|
254
|
+
* @deprecated Since v20.12.0
|
|
255
|
+
*/
|
|
256
|
+
path: string;
|
|
250
257
|
}
|
|
251
258
|
/**
|
|
252
259
|
* A class representing a directory stream.
|
|
@@ -269,7 +276,7 @@ declare module "node:fs" {
|
|
|
269
276
|
* closed after the iterator exits.
|
|
270
277
|
* @since v12.12.0
|
|
271
278
|
*/
|
|
272
|
-
class Dir implements AsyncIterable<Dirent> {
|
|
279
|
+
export class Dir implements AsyncIterable<Dirent> {
|
|
273
280
|
/**
|
|
274
281
|
* The read-only path of this directory as was provided to {@link opendir},{@link opendirSync}, or `fsPromises.opendir()`.
|
|
275
282
|
* @since v12.12.0
|
|
@@ -325,13 +332,15 @@ declare module "node:fs" {
|
|
|
325
332
|
/**
|
|
326
333
|
* Calls `dir.close()` if the directory handle is open, and returns a promise that
|
|
327
334
|
* fulfills when disposal is complete.
|
|
328
|
-
* @since
|
|
335
|
+
* @since v22.17.0
|
|
336
|
+
* @experimental
|
|
329
337
|
*/
|
|
330
338
|
[Symbol.asyncDispose](): Promise<void>;
|
|
331
339
|
/**
|
|
332
340
|
* Calls `dir.closeSync()` if the directory handle is open, and returns
|
|
333
341
|
* `undefined`.
|
|
334
|
-
* @since
|
|
342
|
+
* @since v22.17.0
|
|
343
|
+
* @experimental
|
|
335
344
|
*/
|
|
336
345
|
[Symbol.dispose](): void;
|
|
337
346
|
}
|
|
@@ -341,7 +350,7 @@ declare module "node:fs" {
|
|
|
341
350
|
* Extends `EventEmitter`
|
|
342
351
|
* A successful call to {@link watchFile} method will return a new fs.StatWatcher object.
|
|
343
352
|
*/
|
|
344
|
-
interface StatWatcher extends EventEmitter {
|
|
353
|
+
export interface StatWatcher extends EventEmitter {
|
|
345
354
|
/**
|
|
346
355
|
* When called, requests that the Node.js event loop _not_ exit so long as the `fs.StatWatcher` is active. Calling `watcher.ref()` multiple times will have
|
|
347
356
|
* no effect.
|
|
@@ -362,12 +371,7 @@ declare module "node:fs" {
|
|
|
362
371
|
*/
|
|
363
372
|
unref(): this;
|
|
364
373
|
}
|
|
365
|
-
interface
|
|
366
|
-
"change": [eventType: string, filename: string | NonSharedBuffer];
|
|
367
|
-
"close": [];
|
|
368
|
-
"error": [error: Error];
|
|
369
|
-
}
|
|
370
|
-
interface FSWatcher extends InternalEventEmitter<FSWatcherEventMap> {
|
|
374
|
+
export interface FSWatcher extends EventEmitter {
|
|
371
375
|
/**
|
|
372
376
|
* Stop watching for changes on the given `fs.FSWatcher`. Once stopped, the `fs.FSWatcher` object is no longer usable.
|
|
373
377
|
* @since v0.5.8
|
|
@@ -392,18 +396,44 @@ declare module "node:fs" {
|
|
|
392
396
|
* @since v14.3.0, v12.20.0
|
|
393
397
|
*/
|
|
394
398
|
unref(): this;
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
399
|
+
/**
|
|
400
|
+
* events.EventEmitter
|
|
401
|
+
* 1. change
|
|
402
|
+
* 2. close
|
|
403
|
+
* 3. error
|
|
404
|
+
*/
|
|
405
|
+
addListener(event: string, listener: (...args: any[]) => void): this;
|
|
406
|
+
addListener(event: "change", listener: (eventType: string, filename: string | NonSharedBuffer) => void): this;
|
|
407
|
+
addListener(event: "close", listener: () => void): this;
|
|
408
|
+
addListener(event: "error", listener: (error: Error) => void): this;
|
|
409
|
+
on(event: string, listener: (...args: any[]) => void): this;
|
|
410
|
+
on(event: "change", listener: (eventType: string, filename: string | NonSharedBuffer) => void): this;
|
|
411
|
+
on(event: "close", listener: () => void): this;
|
|
412
|
+
on(event: "error", listener: (error: Error) => void): this;
|
|
413
|
+
once(event: string, listener: (...args: any[]) => void): this;
|
|
414
|
+
once(event: "change", listener: (eventType: string, filename: string | NonSharedBuffer) => void): this;
|
|
415
|
+
once(event: "close", listener: () => void): this;
|
|
416
|
+
once(event: "error", listener: (error: Error) => void): this;
|
|
417
|
+
prependListener(event: string, listener: (...args: any[]) => void): this;
|
|
418
|
+
prependListener(
|
|
419
|
+
event: "change",
|
|
420
|
+
listener: (eventType: string, filename: string | NonSharedBuffer) => void,
|
|
421
|
+
): this;
|
|
422
|
+
prependListener(event: "close", listener: () => void): this;
|
|
423
|
+
prependListener(event: "error", listener: (error: Error) => void): this;
|
|
424
|
+
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
|
425
|
+
prependOnceListener(
|
|
426
|
+
event: "change",
|
|
427
|
+
listener: (eventType: string, filename: string | NonSharedBuffer) => void,
|
|
428
|
+
): this;
|
|
429
|
+
prependOnceListener(event: "close", listener: () => void): this;
|
|
430
|
+
prependOnceListener(event: "error", listener: (error: Error) => void): this;
|
|
401
431
|
}
|
|
402
432
|
/**
|
|
403
433
|
* Instances of `fs.ReadStream` are created and returned using the {@link createReadStream} function.
|
|
404
434
|
* @since v0.1.93
|
|
405
435
|
*/
|
|
406
|
-
class ReadStream extends stream.Readable {
|
|
436
|
+
export class ReadStream extends stream.Readable {
|
|
407
437
|
close(callback?: (err?: NodeJS.ErrnoException | null) => void): void;
|
|
408
438
|
/**
|
|
409
439
|
* The number of bytes that have been read so far.
|
|
@@ -423,250 +453,60 @@ declare module "node:fs" {
|
|
|
423
453
|
* @since v11.2.0, v10.16.0
|
|
424
454
|
*/
|
|
425
455
|
pending: boolean;
|
|
426
|
-
// #region InternalEventEmitter
|
|
427
|
-
addListener<E extends keyof ReadStreamEventMap>(
|
|
428
|
-
eventName: E,
|
|
429
|
-
listener: (...args: ReadStreamEventMap[E]) => void,
|
|
430
|
-
): this;
|
|
431
|
-
addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
432
|
-
emit<E extends keyof ReadStreamEventMap>(eventName: E, ...args: ReadStreamEventMap[E]): boolean;
|
|
433
|
-
emit(eventName: string | symbol, ...args: any[]): boolean;
|
|
434
|
-
listenerCount<E extends keyof ReadStreamEventMap>(
|
|
435
|
-
eventName: E,
|
|
436
|
-
listener?: (...args: ReadStreamEventMap[E]) => void,
|
|
437
|
-
): number;
|
|
438
|
-
listenerCount(eventName: string | symbol, listener?: (...args: any[]) => void): number;
|
|
439
|
-
listeners<E extends keyof ReadStreamEventMap>(eventName: E): ((...args: ReadStreamEventMap[E]) => void)[];
|
|
440
|
-
listeners(eventName: string | symbol): ((...args: any[]) => void)[];
|
|
441
|
-
off<E extends keyof ReadStreamEventMap>(eventName: E, listener: (...args: ReadStreamEventMap[E]) => void): this;
|
|
442
|
-
off(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
443
|
-
on<E extends keyof ReadStreamEventMap>(eventName: E, listener: (...args: ReadStreamEventMap[E]) => void): this;
|
|
444
|
-
on(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
445
|
-
once<E extends keyof ReadStreamEventMap>(
|
|
446
|
-
eventName: E,
|
|
447
|
-
listener: (...args: ReadStreamEventMap[E]) => void,
|
|
448
|
-
): this;
|
|
449
|
-
once(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
450
|
-
prependListener<E extends keyof ReadStreamEventMap>(
|
|
451
|
-
eventName: E,
|
|
452
|
-
listener: (...args: ReadStreamEventMap[E]) => void,
|
|
453
|
-
): this;
|
|
454
|
-
prependListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
455
|
-
prependOnceListener<E extends keyof ReadStreamEventMap>(
|
|
456
|
-
eventName: E,
|
|
457
|
-
listener: (...args: ReadStreamEventMap[E]) => void,
|
|
458
|
-
): this;
|
|
459
|
-
prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
460
|
-
rawListeners<E extends keyof ReadStreamEventMap>(eventName: E): ((...args: ReadStreamEventMap[E]) => void)[];
|
|
461
|
-
rawListeners(eventName: string | symbol): ((...args: any[]) => void)[];
|
|
462
|
-
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
|
463
|
-
removeAllListeners<E extends keyof ReadStreamEventMap>(eventName?: E): this;
|
|
464
|
-
removeAllListeners(eventName?: string | symbol): this;
|
|
465
|
-
removeListener<E extends keyof ReadStreamEventMap>(
|
|
466
|
-
eventName: E,
|
|
467
|
-
listener: (...args: ReadStreamEventMap[E]) => void,
|
|
468
|
-
): this;
|
|
469
|
-
removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
470
|
-
// #endregion
|
|
471
|
-
}
|
|
472
|
-
interface Utf8StreamOptions {
|
|
473
|
-
/**
|
|
474
|
-
* Appends writes to dest file instead of truncating it.
|
|
475
|
-
* @default true
|
|
476
|
-
*/
|
|
477
|
-
append?: boolean | undefined;
|
|
478
456
|
/**
|
|
479
|
-
*
|
|
480
|
-
*
|
|
481
|
-
*
|
|
482
|
-
|
|
483
|
-
contentMode?: "utf8" | "buffer" | undefined;
|
|
484
|
-
/**
|
|
485
|
-
* A path to a file to be written to (mode controlled by the
|
|
486
|
-
* append option).
|
|
487
|
-
*/
|
|
488
|
-
dest?: string | undefined;
|
|
489
|
-
/**
|
|
490
|
-
* A file descriptor, something that is returned by `fs.open()`
|
|
491
|
-
* or `fs.openSync()`.
|
|
457
|
+
* events.EventEmitter
|
|
458
|
+
* 1. open
|
|
459
|
+
* 2. close
|
|
460
|
+
* 3. ready
|
|
492
461
|
*/
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
fs?: object | undefined;
|
|
499
|
-
/**
|
|
500
|
-
* Perform a `fs.fsyncSync()` every time a write is
|
|
501
|
-
* completed.
|
|
502
|
-
*/
|
|
503
|
-
fsync?: boolean | undefined;
|
|
504
|
-
/**
|
|
505
|
-
* The maximum length of the internal buffer. If a write
|
|
506
|
-
* operation would cause the buffer to exceed `maxLength`, the data written is
|
|
507
|
-
* dropped and a drop event is emitted with the dropped data
|
|
508
|
-
*/
|
|
509
|
-
maxLength?: number | undefined;
|
|
510
|
-
/**
|
|
511
|
-
* The maximum number of bytes that can be written;
|
|
512
|
-
* @default 16384
|
|
513
|
-
*/
|
|
514
|
-
maxWrite?: number | undefined;
|
|
515
|
-
/**
|
|
516
|
-
* The minimum length of the internal buffer that is
|
|
517
|
-
* required to be full before flushing.
|
|
518
|
-
*/
|
|
519
|
-
minLength?: number | undefined;
|
|
520
|
-
/**
|
|
521
|
-
* Ensure directory for `dest` file exists when true.
|
|
522
|
-
* @default false
|
|
523
|
-
*/
|
|
524
|
-
mkdir?: boolean | undefined;
|
|
525
|
-
/**
|
|
526
|
-
* Specify the creating file mode (see `fs.open()`).
|
|
527
|
-
*/
|
|
528
|
-
mode?: number | string | undefined;
|
|
529
|
-
/**
|
|
530
|
-
* Calls flush every `periodicFlush` milliseconds.
|
|
531
|
-
*/
|
|
532
|
-
periodicFlush?: number | undefined;
|
|
533
|
-
/**
|
|
534
|
-
* A function that will be called when `write()`,
|
|
535
|
-
* `writeSync()`, or `flushSync()` encounters an `EAGAIN` or `EBUSY` error.
|
|
536
|
-
* If the return value is `true` the operation will be retried, otherwise it
|
|
537
|
-
* will bubble the error. The `err` is the error that caused this function to
|
|
538
|
-
* be called, `writeBufferLen` is the length of the buffer that was written,
|
|
539
|
-
* and `remainingBufferLen` is the length of the remaining buffer that the
|
|
540
|
-
* stream did not try to write.
|
|
541
|
-
*/
|
|
542
|
-
retryEAGAIN?: ((err: Error | null, writeBufferLen: number, remainingBufferLen: number) => boolean) | undefined;
|
|
543
|
-
/**
|
|
544
|
-
* Perform writes synchronously.
|
|
545
|
-
*/
|
|
546
|
-
sync?: boolean | undefined;
|
|
547
|
-
}
|
|
548
|
-
interface Utf8StreamEventMap {
|
|
549
|
-
"close": [];
|
|
550
|
-
"drain": [];
|
|
551
|
-
"drop": [data: string | Buffer];
|
|
552
|
-
"error": [error: Error];
|
|
553
|
-
"finish": [];
|
|
554
|
-
"ready": [];
|
|
555
|
-
"write": [n: number];
|
|
462
|
+
addListener<K extends keyof ReadStreamEvents>(event: K, listener: ReadStreamEvents[K]): this;
|
|
463
|
+
on<K extends keyof ReadStreamEvents>(event: K, listener: ReadStreamEvents[K]): this;
|
|
464
|
+
once<K extends keyof ReadStreamEvents>(event: K, listener: ReadStreamEvents[K]): this;
|
|
465
|
+
prependListener<K extends keyof ReadStreamEvents>(event: K, listener: ReadStreamEvents[K]): this;
|
|
466
|
+
prependOnceListener<K extends keyof ReadStreamEvents>(event: K, listener: ReadStreamEvents[K]): this;
|
|
556
467
|
}
|
|
468
|
+
|
|
557
469
|
/**
|
|
558
|
-
*
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
470
|
+
* The Keys are events of the ReadStream and the values are the functions that are called when the event is emitted.
|
|
471
|
+
*/
|
|
472
|
+
type ReadStreamEvents = {
|
|
473
|
+
close: () => void;
|
|
474
|
+
data: (chunk: Buffer | string) => void;
|
|
475
|
+
end: () => void;
|
|
476
|
+
error: (err: Error) => void;
|
|
477
|
+
open: (fd: number) => void;
|
|
478
|
+
pause: () => void;
|
|
479
|
+
readable: () => void;
|
|
480
|
+
ready: () => void;
|
|
481
|
+
resume: () => void;
|
|
482
|
+
} & CustomEvents;
|
|
483
|
+
|
|
484
|
+
/**
|
|
485
|
+
* string & {} allows to allow any kind of strings for the event
|
|
486
|
+
* but still allows to have auto completion for the normal events.
|
|
563
487
|
*/
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
/**
|
|
567
|
-
* Whether the stream is appending to the file or truncating it.
|
|
568
|
-
*/
|
|
569
|
-
readonly append: boolean;
|
|
570
|
-
/**
|
|
571
|
-
* The type of data that can be written to the stream. Supported
|
|
572
|
-
* values are `'utf8'` or `'buffer'`.
|
|
573
|
-
* @default 'utf8'
|
|
574
|
-
*/
|
|
575
|
-
readonly contentMode: "utf8" | "buffer";
|
|
576
|
-
/**
|
|
577
|
-
* Close the stream immediately, without flushing the internal buffer.
|
|
578
|
-
*/
|
|
579
|
-
destroy(): void;
|
|
580
|
-
/**
|
|
581
|
-
* Close the stream gracefully, flushing the internal buffer before closing.
|
|
582
|
-
*/
|
|
583
|
-
end(): void;
|
|
584
|
-
/**
|
|
585
|
-
* The file descriptor that is being written to.
|
|
586
|
-
*/
|
|
587
|
-
readonly fd: number;
|
|
588
|
-
/**
|
|
589
|
-
* The file that is being written to.
|
|
590
|
-
*/
|
|
591
|
-
readonly file: string;
|
|
592
|
-
/**
|
|
593
|
-
* Writes the current buffer to the file if a write was not in progress. Do
|
|
594
|
-
* nothing if `minLength` is zero or if it is already writing.
|
|
595
|
-
*/
|
|
596
|
-
flush(callback: (err: Error | null) => void): void;
|
|
597
|
-
/**
|
|
598
|
-
* Flushes the buffered data synchronously. This is a costly operation.
|
|
599
|
-
*/
|
|
600
|
-
flushSync(): void;
|
|
601
|
-
/**
|
|
602
|
-
* Whether the stream is performing a `fs.fsyncSync()` after every
|
|
603
|
-
* write operation.
|
|
604
|
-
*/
|
|
605
|
-
readonly fsync: boolean;
|
|
606
|
-
/**
|
|
607
|
-
* The maximum length of the internal buffer. If a write
|
|
608
|
-
* operation would cause the buffer to exceed `maxLength`, the data written is
|
|
609
|
-
* dropped and a drop event is emitted with the dropped data.
|
|
610
|
-
*/
|
|
611
|
-
readonly maxLength: number;
|
|
612
|
-
/**
|
|
613
|
-
* The minimum length of the internal buffer that is required to be
|
|
614
|
-
* full before flushing.
|
|
615
|
-
*/
|
|
616
|
-
readonly minLength: number;
|
|
617
|
-
/**
|
|
618
|
-
* Whether the stream should ensure that the directory for the
|
|
619
|
-
* `dest` file exists. If `true`, it will create the directory if it does not
|
|
620
|
-
* exist.
|
|
621
|
-
* @default false
|
|
622
|
-
*/
|
|
623
|
-
readonly mkdir: boolean;
|
|
624
|
-
/**
|
|
625
|
-
* The mode of the file that is being written to.
|
|
626
|
-
*/
|
|
627
|
-
readonly mode: number | string;
|
|
628
|
-
/**
|
|
629
|
-
* The number of milliseconds between flushes. If set to `0`, no
|
|
630
|
-
* periodic flushes will be performed.
|
|
631
|
-
*/
|
|
632
|
-
readonly periodicFlush: number;
|
|
633
|
-
/**
|
|
634
|
-
* Reopen the file in place, useful for log rotation.
|
|
635
|
-
* @param file A path to a file to be written to (mode
|
|
636
|
-
* controlled by the append option).
|
|
637
|
-
*/
|
|
638
|
-
reopen(file: PathLike): void;
|
|
639
|
-
/**
|
|
640
|
-
* Whether the stream is writing synchronously or asynchronously.
|
|
641
|
-
*/
|
|
642
|
-
readonly sync: boolean;
|
|
643
|
-
/**
|
|
644
|
-
* When the `options.contentMode` is set to `'utf8'` when the stream is created,
|
|
645
|
-
* the `data` argument must be a string. If the `contentMode` is set to `'buffer'`,
|
|
646
|
-
* the `data` argument must be a `Buffer`.
|
|
647
|
-
* @param data The data to write.
|
|
648
|
-
*/
|
|
649
|
-
write(data: string | Buffer): boolean;
|
|
650
|
-
/**
|
|
651
|
-
* Whether the stream is currently writing data to the file.
|
|
652
|
-
*/
|
|
653
|
-
readonly writing: boolean;
|
|
654
|
-
/**
|
|
655
|
-
* Calls `utf8Stream.destroy()`.
|
|
656
|
-
*/
|
|
657
|
-
[Symbol.dispose](): void;
|
|
658
|
-
}
|
|
659
|
-
interface Utf8Stream extends InternalEventEmitter<Utf8StreamEventMap> {}
|
|
660
|
-
interface WriteStreamEventMap extends stream.WritableEventMap {
|
|
661
|
-
"close": [];
|
|
662
|
-
"open": [fd: number];
|
|
663
|
-
"ready": [];
|
|
664
|
-
}
|
|
488
|
+
type CustomEvents = { [Key in string & {} | symbol]: (...args: any[]) => void };
|
|
489
|
+
|
|
665
490
|
/**
|
|
491
|
+
* The Keys are events of the WriteStream and the values are the functions that are called when the event is emitted.
|
|
492
|
+
*/
|
|
493
|
+
type WriteStreamEvents = {
|
|
494
|
+
close: () => void;
|
|
495
|
+
drain: () => void;
|
|
496
|
+
error: (err: Error) => void;
|
|
497
|
+
finish: () => void;
|
|
498
|
+
open: (fd: number) => void;
|
|
499
|
+
pipe: (src: stream.Readable) => void;
|
|
500
|
+
ready: () => void;
|
|
501
|
+
unpipe: (src: stream.Readable) => void;
|
|
502
|
+
} & CustomEvents;
|
|
503
|
+
/**
|
|
504
|
+
* * Extends `stream.Writable`
|
|
505
|
+
*
|
|
666
506
|
* Instances of `fs.WriteStream` are created and returned using the {@link createWriteStream} function.
|
|
667
507
|
* @since v0.1.93
|
|
668
508
|
*/
|
|
669
|
-
class WriteStream extends stream.Writable {
|
|
509
|
+
export class WriteStream extends stream.Writable {
|
|
670
510
|
/**
|
|
671
511
|
* Closes `writeStream`. Optionally accepts a
|
|
672
512
|
* callback that will be executed once the `writeStream`is closed.
|
|
@@ -692,57 +532,17 @@ declare module "node:fs" {
|
|
|
692
532
|
* @since v11.2.0
|
|
693
533
|
*/
|
|
694
534
|
pending: boolean;
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
): number;
|
|
707
|
-
listenerCount(eventName: string | symbol, listener?: (...args: any[]) => void): number;
|
|
708
|
-
listeners<E extends keyof WriteStreamEventMap>(eventName: E): ((...args: WriteStreamEventMap[E]) => void)[];
|
|
709
|
-
listeners(eventName: string | symbol): ((...args: any[]) => void)[];
|
|
710
|
-
off<E extends keyof WriteStreamEventMap>(
|
|
711
|
-
eventName: E,
|
|
712
|
-
listener: (...args: WriteStreamEventMap[E]) => void,
|
|
713
|
-
): this;
|
|
714
|
-
off(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
715
|
-
on<E extends keyof WriteStreamEventMap>(
|
|
716
|
-
eventName: E,
|
|
717
|
-
listener: (...args: WriteStreamEventMap[E]) => void,
|
|
718
|
-
): this;
|
|
719
|
-
on(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
720
|
-
once<E extends keyof WriteStreamEventMap>(
|
|
721
|
-
eventName: E,
|
|
722
|
-
listener: (...args: WriteStreamEventMap[E]) => void,
|
|
723
|
-
): this;
|
|
724
|
-
once(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
725
|
-
prependListener<E extends keyof WriteStreamEventMap>(
|
|
726
|
-
eventName: E,
|
|
727
|
-
listener: (...args: WriteStreamEventMap[E]) => void,
|
|
728
|
-
): this;
|
|
729
|
-
prependListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
730
|
-
prependOnceListener<E extends keyof WriteStreamEventMap>(
|
|
731
|
-
eventName: E,
|
|
732
|
-
listener: (...args: WriteStreamEventMap[E]) => void,
|
|
733
|
-
): this;
|
|
734
|
-
prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
735
|
-
rawListeners<E extends keyof WriteStreamEventMap>(eventName: E): ((...args: WriteStreamEventMap[E]) => void)[];
|
|
736
|
-
rawListeners(eventName: string | symbol): ((...args: any[]) => void)[];
|
|
737
|
-
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
|
738
|
-
removeAllListeners<E extends keyof WriteStreamEventMap>(eventName?: E): this;
|
|
739
|
-
removeAllListeners(eventName?: string | symbol): this;
|
|
740
|
-
removeListener<E extends keyof WriteStreamEventMap>(
|
|
741
|
-
eventName: E,
|
|
742
|
-
listener: (...args: WriteStreamEventMap[E]) => void,
|
|
743
|
-
): this;
|
|
744
|
-
removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
745
|
-
// #endregion
|
|
535
|
+
/**
|
|
536
|
+
* events.EventEmitter
|
|
537
|
+
* 1. open
|
|
538
|
+
* 2. close
|
|
539
|
+
* 3. ready
|
|
540
|
+
*/
|
|
541
|
+
addListener<K extends keyof WriteStreamEvents>(event: K, listener: WriteStreamEvents[K]): this;
|
|
542
|
+
on<K extends keyof WriteStreamEvents>(event: K, listener: WriteStreamEvents[K]): this;
|
|
543
|
+
once<K extends keyof WriteStreamEvents>(event: K, listener: WriteStreamEvents[K]): this;
|
|
544
|
+
prependListener<K extends keyof WriteStreamEvents>(event: K, listener: WriteStreamEvents[K]): this;
|
|
545
|
+
prependOnceListener<K extends keyof WriteStreamEvents>(event: K, listener: WriteStreamEvents[K]): this;
|
|
746
546
|
}
|
|
747
547
|
/**
|
|
748
548
|
* Asynchronously rename file at `oldPath` to the pathname provided
|
|
@@ -763,8 +563,8 @@ declare module "node:fs" {
|
|
|
763
563
|
* ```
|
|
764
564
|
* @since v0.0.2
|
|
765
565
|
*/
|
|
766
|
-
function rename(oldPath: PathLike, newPath: PathLike, callback: NoParamCallback): void;
|
|
767
|
-
namespace rename {
|
|
566
|
+
export function rename(oldPath: PathLike, newPath: PathLike, callback: NoParamCallback): void;
|
|
567
|
+
export namespace rename {
|
|
768
568
|
/**
|
|
769
569
|
* Asynchronous rename(2) - Change the name or location of a file or directory.
|
|
770
570
|
* @param oldPath A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -780,7 +580,7 @@ declare module "node:fs" {
|
|
|
780
580
|
* See the POSIX [`rename(2)`](http://man7.org/linux/man-pages/man2/rename.2.html) documentation for more details.
|
|
781
581
|
* @since v0.1.21
|
|
782
582
|
*/
|
|
783
|
-
function renameSync(oldPath: PathLike, newPath: PathLike): void;
|
|
583
|
+
export function renameSync(oldPath: PathLike, newPath: PathLike): void;
|
|
784
584
|
/**
|
|
785
585
|
* Truncates the file. No arguments other than a possible exception are
|
|
786
586
|
* given to the completion callback. A file descriptor can also be passed as the
|
|
@@ -802,13 +602,13 @@ declare module "node:fs" {
|
|
|
802
602
|
* @since v0.8.6
|
|
803
603
|
* @param [len=0]
|
|
804
604
|
*/
|
|
805
|
-
function truncate(path: PathLike, len: number | undefined, callback: NoParamCallback): void;
|
|
605
|
+
export function truncate(path: PathLike, len: number | undefined, callback: NoParamCallback): void;
|
|
806
606
|
/**
|
|
807
607
|
* Asynchronous truncate(2) - Truncate a file to a specified length.
|
|
808
608
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
809
609
|
*/
|
|
810
|
-
function truncate(path: PathLike, callback: NoParamCallback): void;
|
|
811
|
-
namespace truncate {
|
|
610
|
+
export function truncate(path: PathLike, callback: NoParamCallback): void;
|
|
611
|
+
export namespace truncate {
|
|
812
612
|
/**
|
|
813
613
|
* Asynchronous truncate(2) - Truncate a file to a specified length.
|
|
814
614
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -825,7 +625,7 @@ declare module "node:fs" {
|
|
|
825
625
|
* @since v0.8.6
|
|
826
626
|
* @param [len=0]
|
|
827
627
|
*/
|
|
828
|
-
function truncateSync(path: PathLike, len?: number): void;
|
|
628
|
+
export function truncateSync(path: PathLike, len?: number): void;
|
|
829
629
|
/**
|
|
830
630
|
* Truncates the file descriptor. No arguments other than a possible exception are
|
|
831
631
|
* given to the completion callback.
|
|
@@ -869,13 +669,13 @@ declare module "node:fs" {
|
|
|
869
669
|
* @since v0.8.6
|
|
870
670
|
* @param [len=0]
|
|
871
671
|
*/
|
|
872
|
-
function ftruncate(fd: number, len: number | undefined, callback: NoParamCallback): void;
|
|
672
|
+
export function ftruncate(fd: number, len: number | undefined, callback: NoParamCallback): void;
|
|
873
673
|
/**
|
|
874
674
|
* Asynchronous ftruncate(2) - Truncate a file to a specified length.
|
|
875
675
|
* @param fd A file descriptor.
|
|
876
676
|
*/
|
|
877
|
-
function ftruncate(fd: number, callback: NoParamCallback): void;
|
|
878
|
-
namespace ftruncate {
|
|
677
|
+
export function ftruncate(fd: number, callback: NoParamCallback): void;
|
|
678
|
+
export namespace ftruncate {
|
|
879
679
|
/**
|
|
880
680
|
* Asynchronous ftruncate(2) - Truncate a file to a specified length.
|
|
881
681
|
* @param fd A file descriptor.
|
|
@@ -891,7 +691,7 @@ declare module "node:fs" {
|
|
|
891
691
|
* @since v0.8.6
|
|
892
692
|
* @param [len=0]
|
|
893
693
|
*/
|
|
894
|
-
function ftruncateSync(fd: number, len?: number): void;
|
|
694
|
+
export function ftruncateSync(fd: number, len?: number): void;
|
|
895
695
|
/**
|
|
896
696
|
* Asynchronously changes owner and group of a file. No arguments other than a
|
|
897
697
|
* possible exception are given to the completion callback.
|
|
@@ -899,8 +699,8 @@ declare module "node:fs" {
|
|
|
899
699
|
* See the POSIX [`chown(2)`](http://man7.org/linux/man-pages/man2/chown.2.html) documentation for more detail.
|
|
900
700
|
* @since v0.1.97
|
|
901
701
|
*/
|
|
902
|
-
function chown(path: PathLike, uid: number, gid: number, callback: NoParamCallback): void;
|
|
903
|
-
namespace chown {
|
|
702
|
+
export function chown(path: PathLike, uid: number, gid: number, callback: NoParamCallback): void;
|
|
703
|
+
export namespace chown {
|
|
904
704
|
/**
|
|
905
705
|
* Asynchronous chown(2) - Change ownership of a file.
|
|
906
706
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -914,7 +714,7 @@ declare module "node:fs" {
|
|
|
914
714
|
* See the POSIX [`chown(2)`](http://man7.org/linux/man-pages/man2/chown.2.html) documentation for more detail.
|
|
915
715
|
* @since v0.1.97
|
|
916
716
|
*/
|
|
917
|
-
function chownSync(path: PathLike, uid: number, gid: number): void;
|
|
717
|
+
export function chownSync(path: PathLike, uid: number, gid: number): void;
|
|
918
718
|
/**
|
|
919
719
|
* Sets the owner of the file. No arguments other than a possible exception are
|
|
920
720
|
* given to the completion callback.
|
|
@@ -922,8 +722,8 @@ declare module "node:fs" {
|
|
|
922
722
|
* See the POSIX [`fchown(2)`](http://man7.org/linux/man-pages/man2/fchown.2.html) documentation for more detail.
|
|
923
723
|
* @since v0.4.7
|
|
924
724
|
*/
|
|
925
|
-
function fchown(fd: number, uid: number, gid: number, callback: NoParamCallback): void;
|
|
926
|
-
namespace fchown {
|
|
725
|
+
export function fchown(fd: number, uid: number, gid: number, callback: NoParamCallback): void;
|
|
726
|
+
export namespace fchown {
|
|
927
727
|
/**
|
|
928
728
|
* Asynchronous fchown(2) - Change ownership of a file.
|
|
929
729
|
* @param fd A file descriptor.
|
|
@@ -938,15 +738,15 @@ declare module "node:fs" {
|
|
|
938
738
|
* @param uid The file's new owner's user id.
|
|
939
739
|
* @param gid The file's new group's group id.
|
|
940
740
|
*/
|
|
941
|
-
function fchownSync(fd: number, uid: number, gid: number): void;
|
|
741
|
+
export function fchownSync(fd: number, uid: number, gid: number): void;
|
|
942
742
|
/**
|
|
943
743
|
* Set the owner of the symbolic link. No arguments other than a possible
|
|
944
744
|
* exception are given to the completion callback.
|
|
945
745
|
*
|
|
946
746
|
* See the POSIX [`lchown(2)`](http://man7.org/linux/man-pages/man2/lchown.2.html) documentation for more detail.
|
|
947
747
|
*/
|
|
948
|
-
function lchown(path: PathLike, uid: number, gid: number, callback: NoParamCallback): void;
|
|
949
|
-
namespace lchown {
|
|
748
|
+
export function lchown(path: PathLike, uid: number, gid: number, callback: NoParamCallback): void;
|
|
749
|
+
export namespace lchown {
|
|
950
750
|
/**
|
|
951
751
|
* Asynchronous lchown(2) - Change ownership of a file. Does not dereference symbolic links.
|
|
952
752
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -960,7 +760,7 @@ declare module "node:fs" {
|
|
|
960
760
|
* @param uid The file's new owner's user id.
|
|
961
761
|
* @param gid The file's new group's group id.
|
|
962
762
|
*/
|
|
963
|
-
function lchownSync(path: PathLike, uid: number, gid: number): void;
|
|
763
|
+
export function lchownSync(path: PathLike, uid: number, gid: number): void;
|
|
964
764
|
/**
|
|
965
765
|
* Changes the access and modification times of a file in the same way as {@link utimes}, with the difference that if the path refers to a symbolic
|
|
966
766
|
* link, then the link is not dereferenced: instead, the timestamps of the
|
|
@@ -970,8 +770,8 @@ declare module "node:fs" {
|
|
|
970
770
|
* callback.
|
|
971
771
|
* @since v14.5.0, v12.19.0
|
|
972
772
|
*/
|
|
973
|
-
function lutimes(path: PathLike, atime: TimeLike, mtime: TimeLike, callback: NoParamCallback): void;
|
|
974
|
-
namespace lutimes {
|
|
773
|
+
export function lutimes(path: PathLike, atime: TimeLike, mtime: TimeLike, callback: NoParamCallback): void;
|
|
774
|
+
export namespace lutimes {
|
|
975
775
|
/**
|
|
976
776
|
* Changes the access and modification times of a file in the same way as `fsPromises.utimes()`,
|
|
977
777
|
* with the difference that if the path refers to a symbolic link, then the link is not
|
|
@@ -988,7 +788,7 @@ declare module "node:fs" {
|
|
|
988
788
|
* the operation fails. This is the synchronous version of {@link lutimes}.
|
|
989
789
|
* @since v14.5.0, v12.19.0
|
|
990
790
|
*/
|
|
991
|
-
function lutimesSync(path: PathLike, atime: TimeLike, mtime: TimeLike): void;
|
|
791
|
+
export function lutimesSync(path: PathLike, atime: TimeLike, mtime: TimeLike): void;
|
|
992
792
|
/**
|
|
993
793
|
* Asynchronously changes the permissions of a file. No arguments other than a
|
|
994
794
|
* possible exception are given to the completion callback.
|
|
@@ -1005,8 +805,8 @@ declare module "node:fs" {
|
|
|
1005
805
|
* ```
|
|
1006
806
|
* @since v0.1.30
|
|
1007
807
|
*/
|
|
1008
|
-
function chmod(path: PathLike, mode: Mode, callback: NoParamCallback): void;
|
|
1009
|
-
namespace chmod {
|
|
808
|
+
export function chmod(path: PathLike, mode: Mode, callback: NoParamCallback): void;
|
|
809
|
+
export namespace chmod {
|
|
1010
810
|
/**
|
|
1011
811
|
* Asynchronous chmod(2) - Change permissions of a file.
|
|
1012
812
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -1021,7 +821,7 @@ declare module "node:fs" {
|
|
|
1021
821
|
* See the POSIX [`chmod(2)`](http://man7.org/linux/man-pages/man2/chmod.2.html) documentation for more detail.
|
|
1022
822
|
* @since v0.6.7
|
|
1023
823
|
*/
|
|
1024
|
-
function chmodSync(path: PathLike, mode: Mode): void;
|
|
824
|
+
export function chmodSync(path: PathLike, mode: Mode): void;
|
|
1025
825
|
/**
|
|
1026
826
|
* Sets the permissions on the file. No arguments other than a possible exception
|
|
1027
827
|
* are given to the completion callback.
|
|
@@ -1029,8 +829,8 @@ declare module "node:fs" {
|
|
|
1029
829
|
* See the POSIX [`fchmod(2)`](http://man7.org/linux/man-pages/man2/fchmod.2.html) documentation for more detail.
|
|
1030
830
|
* @since v0.4.7
|
|
1031
831
|
*/
|
|
1032
|
-
function fchmod(fd: number, mode: Mode, callback: NoParamCallback): void;
|
|
1033
|
-
namespace fchmod {
|
|
832
|
+
export function fchmod(fd: number, mode: Mode, callback: NoParamCallback): void;
|
|
833
|
+
export namespace fchmod {
|
|
1034
834
|
/**
|
|
1035
835
|
* Asynchronous fchmod(2) - Change permissions of a file.
|
|
1036
836
|
* @param fd A file descriptor.
|
|
@@ -1044,7 +844,7 @@ declare module "node:fs" {
|
|
|
1044
844
|
* See the POSIX [`fchmod(2)`](http://man7.org/linux/man-pages/man2/fchmod.2.html) documentation for more detail.
|
|
1045
845
|
* @since v0.4.7
|
|
1046
846
|
*/
|
|
1047
|
-
function fchmodSync(fd: number, mode: Mode): void;
|
|
847
|
+
export function fchmodSync(fd: number, mode: Mode): void;
|
|
1048
848
|
/**
|
|
1049
849
|
* Changes the permissions on a symbolic link. No arguments other than a possible
|
|
1050
850
|
* exception are given to the completion callback.
|
|
@@ -1054,9 +854,9 @@ declare module "node:fs" {
|
|
|
1054
854
|
* See the POSIX [`lchmod(2)`](https://www.freebsd.org/cgi/man.cgi?query=lchmod&sektion=2) documentation for more detail.
|
|
1055
855
|
* @deprecated Since v0.4.7
|
|
1056
856
|
*/
|
|
1057
|
-
function lchmod(path: PathLike, mode: Mode, callback: NoParamCallback): void;
|
|
857
|
+
export function lchmod(path: PathLike, mode: Mode, callback: NoParamCallback): void;
|
|
1058
858
|
/** @deprecated */
|
|
1059
|
-
namespace lchmod {
|
|
859
|
+
export namespace lchmod {
|
|
1060
860
|
/**
|
|
1061
861
|
* Asynchronous lchmod(2) - Change permissions of a file. Does not dereference symbolic links.
|
|
1062
862
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -1072,7 +872,7 @@ declare module "node:fs" {
|
|
|
1072
872
|
* See the POSIX [`lchmod(2)`](https://www.freebsd.org/cgi/man.cgi?query=lchmod&sektion=2) documentation for more detail.
|
|
1073
873
|
* @deprecated Since v0.4.7
|
|
1074
874
|
*/
|
|
1075
|
-
function lchmodSync(path: PathLike, mode: Mode): void;
|
|
875
|
+
export function lchmodSync(path: PathLike, mode: Mode): void;
|
|
1076
876
|
/**
|
|
1077
877
|
* Asynchronous [`stat(2)`](http://man7.org/linux/man-pages/man2/stat.2.html). The callback gets two arguments `(err, stats)` where`stats` is an `fs.Stats` object.
|
|
1078
878
|
*
|
|
@@ -1158,8 +958,8 @@ declare module "node:fs" {
|
|
|
1158
958
|
* ```
|
|
1159
959
|
* @since v0.0.2
|
|
1160
960
|
*/
|
|
1161
|
-
function stat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
|
|
1162
|
-
function stat(
|
|
961
|
+
export function stat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
|
|
962
|
+
export function stat(
|
|
1163
963
|
path: PathLike,
|
|
1164
964
|
options:
|
|
1165
965
|
| (StatOptions & {
|
|
@@ -1168,19 +968,19 @@ declare module "node:fs" {
|
|
|
1168
968
|
| undefined,
|
|
1169
969
|
callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void,
|
|
1170
970
|
): void;
|
|
1171
|
-
function stat(
|
|
971
|
+
export function stat(
|
|
1172
972
|
path: PathLike,
|
|
1173
973
|
options: StatOptions & {
|
|
1174
974
|
bigint: true;
|
|
1175
975
|
},
|
|
1176
976
|
callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void,
|
|
1177
977
|
): void;
|
|
1178
|
-
function stat(
|
|
978
|
+
export function stat(
|
|
1179
979
|
path: PathLike,
|
|
1180
980
|
options: StatOptions | undefined,
|
|
1181
981
|
callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void,
|
|
1182
982
|
): void;
|
|
1183
|
-
namespace stat {
|
|
983
|
+
export namespace stat {
|
|
1184
984
|
/**
|
|
1185
985
|
* Asynchronous stat(2) - Get file status.
|
|
1186
986
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -1199,7 +999,7 @@ declare module "node:fs" {
|
|
|
1199
999
|
): Promise<BigIntStats>;
|
|
1200
1000
|
function __promisify__(path: PathLike, options?: StatOptions): Promise<Stats | BigIntStats>;
|
|
1201
1001
|
}
|
|
1202
|
-
interface StatSyncFn extends Function {
|
|
1002
|
+
export interface StatSyncFn extends Function {
|
|
1203
1003
|
(path: PathLike, options?: undefined): Stats;
|
|
1204
1004
|
(
|
|
1205
1005
|
path: PathLike,
|
|
@@ -1240,15 +1040,15 @@ declare module "node:fs" {
|
|
|
1240
1040
|
* Synchronous stat(2) - Get file status.
|
|
1241
1041
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1242
1042
|
*/
|
|
1243
|
-
const statSync: StatSyncFn;
|
|
1043
|
+
export const statSync: StatSyncFn;
|
|
1244
1044
|
/**
|
|
1245
1045
|
* Invokes the callback with the `fs.Stats` for the file descriptor.
|
|
1246
1046
|
*
|
|
1247
1047
|
* See the POSIX [`fstat(2)`](http://man7.org/linux/man-pages/man2/fstat.2.html) documentation for more detail.
|
|
1248
1048
|
* @since v0.1.95
|
|
1249
1049
|
*/
|
|
1250
|
-
function fstat(fd: number, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
|
|
1251
|
-
function fstat(
|
|
1050
|
+
export function fstat(fd: number, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
|
|
1051
|
+
export function fstat(
|
|
1252
1052
|
fd: number,
|
|
1253
1053
|
options:
|
|
1254
1054
|
| (StatOptions & {
|
|
@@ -1257,19 +1057,19 @@ declare module "node:fs" {
|
|
|
1257
1057
|
| undefined,
|
|
1258
1058
|
callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void,
|
|
1259
1059
|
): void;
|
|
1260
|
-
function fstat(
|
|
1060
|
+
export function fstat(
|
|
1261
1061
|
fd: number,
|
|
1262
1062
|
options: StatOptions & {
|
|
1263
1063
|
bigint: true;
|
|
1264
1064
|
},
|
|
1265
1065
|
callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void,
|
|
1266
1066
|
): void;
|
|
1267
|
-
function fstat(
|
|
1067
|
+
export function fstat(
|
|
1268
1068
|
fd: number,
|
|
1269
1069
|
options: StatOptions | undefined,
|
|
1270
1070
|
callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void,
|
|
1271
1071
|
): void;
|
|
1272
|
-
namespace fstat {
|
|
1072
|
+
export namespace fstat {
|
|
1273
1073
|
/**
|
|
1274
1074
|
* Asynchronous fstat(2) - Get file status.
|
|
1275
1075
|
* @param fd A file descriptor.
|
|
@@ -1294,19 +1094,19 @@ declare module "node:fs" {
|
|
|
1294
1094
|
* See the POSIX [`fstat(2)`](http://man7.org/linux/man-pages/man2/fstat.2.html) documentation for more detail.
|
|
1295
1095
|
* @since v0.1.95
|
|
1296
1096
|
*/
|
|
1297
|
-
function fstatSync(
|
|
1097
|
+
export function fstatSync(
|
|
1298
1098
|
fd: number,
|
|
1299
1099
|
options?: StatOptions & {
|
|
1300
1100
|
bigint?: false | undefined;
|
|
1301
1101
|
},
|
|
1302
1102
|
): Stats;
|
|
1303
|
-
function fstatSync(
|
|
1103
|
+
export function fstatSync(
|
|
1304
1104
|
fd: number,
|
|
1305
1105
|
options: StatOptions & {
|
|
1306
1106
|
bigint: true;
|
|
1307
1107
|
},
|
|
1308
1108
|
): BigIntStats;
|
|
1309
|
-
function fstatSync(fd: number, options?: StatOptions): Stats | BigIntStats;
|
|
1109
|
+
export function fstatSync(fd: number, options?: StatOptions): Stats | BigIntStats;
|
|
1310
1110
|
/**
|
|
1311
1111
|
* Retrieves the `fs.Stats` for the symbolic link referred to by the path.
|
|
1312
1112
|
* The callback gets two arguments `(err, stats)` where `stats` is a `fs.Stats` object. `lstat()` is identical to `stat()`, except that if `path` is a symbolic
|
|
@@ -1315,8 +1115,8 @@ declare module "node:fs" {
|
|
|
1315
1115
|
* See the POSIX [`lstat(2)`](http://man7.org/linux/man-pages/man2/lstat.2.html) documentation for more details.
|
|
1316
1116
|
* @since v0.1.30
|
|
1317
1117
|
*/
|
|
1318
|
-
function lstat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
|
|
1319
|
-
function lstat(
|
|
1118
|
+
export function lstat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
|
|
1119
|
+
export function lstat(
|
|
1320
1120
|
path: PathLike,
|
|
1321
1121
|
options:
|
|
1322
1122
|
| (StatOptions & {
|
|
@@ -1325,19 +1125,19 @@ declare module "node:fs" {
|
|
|
1325
1125
|
| undefined,
|
|
1326
1126
|
callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void,
|
|
1327
1127
|
): void;
|
|
1328
|
-
function lstat(
|
|
1128
|
+
export function lstat(
|
|
1329
1129
|
path: PathLike,
|
|
1330
1130
|
options: StatOptions & {
|
|
1331
1131
|
bigint: true;
|
|
1332
1132
|
},
|
|
1333
1133
|
callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void,
|
|
1334
1134
|
): void;
|
|
1335
|
-
function lstat(
|
|
1135
|
+
export function lstat(
|
|
1336
1136
|
path: PathLike,
|
|
1337
1137
|
options: StatOptions | undefined,
|
|
1338
1138
|
callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void,
|
|
1339
1139
|
): void;
|
|
1340
|
-
namespace lstat {
|
|
1140
|
+
export namespace lstat {
|
|
1341
1141
|
/**
|
|
1342
1142
|
* Asynchronous lstat(2) - Get file status. Does not dereference symbolic links.
|
|
1343
1143
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -1364,8 +1164,8 @@ declare module "node:fs" {
|
|
|
1364
1164
|
* @since v19.6.0, v18.15.0
|
|
1365
1165
|
* @param path A path to an existing file or directory on the file system to be queried.
|
|
1366
1166
|
*/
|
|
1367
|
-
function statfs(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: StatsFs) => void): void;
|
|
1368
|
-
function statfs(
|
|
1167
|
+
export function statfs(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: StatsFs) => void): void;
|
|
1168
|
+
export function statfs(
|
|
1369
1169
|
path: PathLike,
|
|
1370
1170
|
options:
|
|
1371
1171
|
| (StatFsOptions & {
|
|
@@ -1374,19 +1174,19 @@ declare module "node:fs" {
|
|
|
1374
1174
|
| undefined,
|
|
1375
1175
|
callback: (err: NodeJS.ErrnoException | null, stats: StatsFs) => void,
|
|
1376
1176
|
): void;
|
|
1377
|
-
function statfs(
|
|
1177
|
+
export function statfs(
|
|
1378
1178
|
path: PathLike,
|
|
1379
1179
|
options: StatFsOptions & {
|
|
1380
1180
|
bigint: true;
|
|
1381
1181
|
},
|
|
1382
1182
|
callback: (err: NodeJS.ErrnoException | null, stats: BigIntStatsFs) => void,
|
|
1383
1183
|
): void;
|
|
1384
|
-
function statfs(
|
|
1184
|
+
export function statfs(
|
|
1385
1185
|
path: PathLike,
|
|
1386
1186
|
options: StatFsOptions | undefined,
|
|
1387
1187
|
callback: (err: NodeJS.ErrnoException | null, stats: StatsFs | BigIntStatsFs) => void,
|
|
1388
1188
|
): void;
|
|
1389
|
-
namespace statfs {
|
|
1189
|
+
export namespace statfs {
|
|
1390
1190
|
/**
|
|
1391
1191
|
* Asynchronous statfs(2) - Returns information about the mounted file system which contains path. The callback gets two arguments (err, stats) where stats is an <fs.StatFs> object.
|
|
1392
1192
|
* @param path A path to an existing file or directory on the file system to be queried.
|
|
@@ -1413,32 +1213,32 @@ declare module "node:fs" {
|
|
|
1413
1213
|
* @since v19.6.0, v18.15.0
|
|
1414
1214
|
* @param path A path to an existing file or directory on the file system to be queried.
|
|
1415
1215
|
*/
|
|
1416
|
-
function statfsSync(
|
|
1216
|
+
export function statfsSync(
|
|
1417
1217
|
path: PathLike,
|
|
1418
1218
|
options?: StatFsOptions & {
|
|
1419
1219
|
bigint?: false | undefined;
|
|
1420
1220
|
},
|
|
1421
1221
|
): StatsFs;
|
|
1422
|
-
function statfsSync(
|
|
1222
|
+
export function statfsSync(
|
|
1423
1223
|
path: PathLike,
|
|
1424
1224
|
options: StatFsOptions & {
|
|
1425
1225
|
bigint: true;
|
|
1426
1226
|
},
|
|
1427
1227
|
): BigIntStatsFs;
|
|
1428
|
-
function statfsSync(path: PathLike, options?: StatFsOptions): StatsFs | BigIntStatsFs;
|
|
1228
|
+
export function statfsSync(path: PathLike, options?: StatFsOptions): StatsFs | BigIntStatsFs;
|
|
1429
1229
|
/**
|
|
1430
1230
|
* Synchronous lstat(2) - Get file status. Does not dereference symbolic links.
|
|
1431
1231
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1432
1232
|
*/
|
|
1433
|
-
const lstatSync: StatSyncFn;
|
|
1233
|
+
export const lstatSync: StatSyncFn;
|
|
1434
1234
|
/**
|
|
1435
1235
|
* Creates a new link from the `existingPath` to the `newPath`. See the POSIX [`link(2)`](http://man7.org/linux/man-pages/man2/link.2.html) documentation for more detail. No arguments other than
|
|
1436
1236
|
* a possible
|
|
1437
1237
|
* exception are given to the completion callback.
|
|
1438
1238
|
* @since v0.1.31
|
|
1439
1239
|
*/
|
|
1440
|
-
function link(existingPath: PathLike, newPath: PathLike, callback: NoParamCallback): void;
|
|
1441
|
-
namespace link {
|
|
1240
|
+
export function link(existingPath: PathLike, newPath: PathLike, callback: NoParamCallback): void;
|
|
1241
|
+
export namespace link {
|
|
1442
1242
|
/**
|
|
1443
1243
|
* Asynchronous link(2) - Create a new link (also known as a hard link) to an existing file.
|
|
1444
1244
|
* @param existingPath A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -1450,7 +1250,7 @@ declare module "node:fs" {
|
|
|
1450
1250
|
* Creates a new link from the `existingPath` to the `newPath`. See the POSIX [`link(2)`](http://man7.org/linux/man-pages/man2/link.2.html) documentation for more detail. Returns `undefined`.
|
|
1451
1251
|
* @since v0.1.31
|
|
1452
1252
|
*/
|
|
1453
|
-
function linkSync(existingPath: PathLike, newPath: PathLike): void;
|
|
1253
|
+
export function linkSync(existingPath: PathLike, newPath: PathLike): void;
|
|
1454
1254
|
/**
|
|
1455
1255
|
* Creates the link called `path` pointing to `target`. No arguments other than a
|
|
1456
1256
|
* possible exception are given to the completion callback.
|
|
@@ -1484,7 +1284,7 @@ declare module "node:fs" {
|
|
|
1484
1284
|
* @since v0.1.31
|
|
1485
1285
|
* @param [type='null']
|
|
1486
1286
|
*/
|
|
1487
|
-
function symlink(
|
|
1287
|
+
export function symlink(
|
|
1488
1288
|
target: PathLike,
|
|
1489
1289
|
path: PathLike,
|
|
1490
1290
|
type: symlink.Type | undefined | null,
|
|
@@ -1495,8 +1295,8 @@ declare module "node:fs" {
|
|
|
1495
1295
|
* @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol.
|
|
1496
1296
|
* @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol.
|
|
1497
1297
|
*/
|
|
1498
|
-
function symlink(target: PathLike, path: PathLike, callback: NoParamCallback): void;
|
|
1499
|
-
namespace symlink {
|
|
1298
|
+
export function symlink(target: PathLike, path: PathLike, callback: NoParamCallback): void;
|
|
1299
|
+
export namespace symlink {
|
|
1500
1300
|
/**
|
|
1501
1301
|
* Asynchronous symlink(2) - Create a new symbolic link to an existing file.
|
|
1502
1302
|
* @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -1515,7 +1315,7 @@ declare module "node:fs" {
|
|
|
1515
1315
|
* @since v0.1.31
|
|
1516
1316
|
* @param [type='null']
|
|
1517
1317
|
*/
|
|
1518
|
-
function symlinkSync(target: PathLike, path: PathLike, type?: symlink.Type | null): void;
|
|
1318
|
+
export function symlinkSync(target: PathLike, path: PathLike, type?: symlink.Type | null): void;
|
|
1519
1319
|
/**
|
|
1520
1320
|
* Reads the contents of the symbolic link referred to by `path`. The callback gets
|
|
1521
1321
|
* two arguments `(err, linkString)`.
|
|
@@ -1528,7 +1328,7 @@ declare module "node:fs" {
|
|
|
1528
1328
|
* the link path returned will be passed as a `Buffer` object.
|
|
1529
1329
|
* @since v0.1.31
|
|
1530
1330
|
*/
|
|
1531
|
-
function readlink(
|
|
1331
|
+
export function readlink(
|
|
1532
1332
|
path: PathLike,
|
|
1533
1333
|
options: EncodingOption,
|
|
1534
1334
|
callback: (err: NodeJS.ErrnoException | null, linkString: string) => void,
|
|
@@ -1538,7 +1338,7 @@ declare module "node:fs" {
|
|
|
1538
1338
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1539
1339
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1540
1340
|
*/
|
|
1541
|
-
function readlink(
|
|
1341
|
+
export function readlink(
|
|
1542
1342
|
path: PathLike,
|
|
1543
1343
|
options: BufferEncodingOption,
|
|
1544
1344
|
callback: (err: NodeJS.ErrnoException | null, linkString: NonSharedBuffer) => void,
|
|
@@ -1548,7 +1348,7 @@ declare module "node:fs" {
|
|
|
1548
1348
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1549
1349
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1550
1350
|
*/
|
|
1551
|
-
function readlink(
|
|
1351
|
+
export function readlink(
|
|
1552
1352
|
path: PathLike,
|
|
1553
1353
|
options: EncodingOption,
|
|
1554
1354
|
callback: (err: NodeJS.ErrnoException | null, linkString: string | NonSharedBuffer) => void,
|
|
@@ -1557,11 +1357,11 @@ declare module "node:fs" {
|
|
|
1557
1357
|
* Asynchronous readlink(2) - read value of a symbolic link.
|
|
1558
1358
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1559
1359
|
*/
|
|
1560
|
-
function readlink(
|
|
1360
|
+
export function readlink(
|
|
1561
1361
|
path: PathLike,
|
|
1562
1362
|
callback: (err: NodeJS.ErrnoException | null, linkString: string) => void,
|
|
1563
1363
|
): void;
|
|
1564
|
-
namespace readlink {
|
|
1364
|
+
export namespace readlink {
|
|
1565
1365
|
/**
|
|
1566
1366
|
* Asynchronous readlink(2) - read value of a symbolic link.
|
|
1567
1367
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -1592,19 +1392,19 @@ declare module "node:fs" {
|
|
|
1592
1392
|
* the link path returned will be passed as a `Buffer` object.
|
|
1593
1393
|
* @since v0.1.31
|
|
1594
1394
|
*/
|
|
1595
|
-
function readlinkSync(path: PathLike, options?: EncodingOption): string;
|
|
1395
|
+
export function readlinkSync(path: PathLike, options?: EncodingOption): string;
|
|
1596
1396
|
/**
|
|
1597
1397
|
* Synchronous readlink(2) - read value of a symbolic link.
|
|
1598
1398
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1599
1399
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1600
1400
|
*/
|
|
1601
|
-
function readlinkSync(path: PathLike, options: BufferEncodingOption): NonSharedBuffer;
|
|
1401
|
+
export function readlinkSync(path: PathLike, options: BufferEncodingOption): NonSharedBuffer;
|
|
1602
1402
|
/**
|
|
1603
1403
|
* Synchronous readlink(2) - read value of a symbolic link.
|
|
1604
1404
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1605
1405
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1606
1406
|
*/
|
|
1607
|
-
function readlinkSync(path: PathLike, options?: EncodingOption): string | NonSharedBuffer;
|
|
1407
|
+
export function readlinkSync(path: PathLike, options?: EncodingOption): string | NonSharedBuffer;
|
|
1608
1408
|
/**
|
|
1609
1409
|
* Asynchronously computes the canonical pathname by resolving `.`, `..`, and
|
|
1610
1410
|
* symbolic links.
|
|
@@ -1631,7 +1431,7 @@ declare module "node:fs" {
|
|
|
1631
1431
|
* dependent name for that object.
|
|
1632
1432
|
* @since v0.1.31
|
|
1633
1433
|
*/
|
|
1634
|
-
function realpath(
|
|
1434
|
+
export function realpath(
|
|
1635
1435
|
path: PathLike,
|
|
1636
1436
|
options: EncodingOption,
|
|
1637
1437
|
callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void,
|
|
@@ -1641,7 +1441,7 @@ declare module "node:fs" {
|
|
|
1641
1441
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1642
1442
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1643
1443
|
*/
|
|
1644
|
-
function realpath(
|
|
1444
|
+
export function realpath(
|
|
1645
1445
|
path: PathLike,
|
|
1646
1446
|
options: BufferEncodingOption,
|
|
1647
1447
|
callback: (err: NodeJS.ErrnoException | null, resolvedPath: NonSharedBuffer) => void,
|
|
@@ -1651,7 +1451,7 @@ declare module "node:fs" {
|
|
|
1651
1451
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1652
1452
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1653
1453
|
*/
|
|
1654
|
-
function realpath(
|
|
1454
|
+
export function realpath(
|
|
1655
1455
|
path: PathLike,
|
|
1656
1456
|
options: EncodingOption,
|
|
1657
1457
|
callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | NonSharedBuffer) => void,
|
|
@@ -1660,11 +1460,11 @@ declare module "node:fs" {
|
|
|
1660
1460
|
* Asynchronous realpath(3) - return the canonicalized absolute pathname.
|
|
1661
1461
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1662
1462
|
*/
|
|
1663
|
-
function realpath(
|
|
1463
|
+
export function realpath(
|
|
1664
1464
|
path: PathLike,
|
|
1665
1465
|
callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void,
|
|
1666
1466
|
): void;
|
|
1667
|
-
namespace realpath {
|
|
1467
|
+
export namespace realpath {
|
|
1668
1468
|
/**
|
|
1669
1469
|
* Asynchronous realpath(3) - return the canonicalized absolute pathname.
|
|
1670
1470
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -1727,20 +1527,20 @@ declare module "node:fs" {
|
|
|
1727
1527
|
* this API: {@link realpath}.
|
|
1728
1528
|
* @since v0.1.31
|
|
1729
1529
|
*/
|
|
1730
|
-
function realpathSync(path: PathLike, options?: EncodingOption): string;
|
|
1530
|
+
export function realpathSync(path: PathLike, options?: EncodingOption): string;
|
|
1731
1531
|
/**
|
|
1732
1532
|
* Synchronous realpath(3) - return the canonicalized absolute pathname.
|
|
1733
1533
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1734
1534
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1735
1535
|
*/
|
|
1736
|
-
function realpathSync(path: PathLike, options: BufferEncodingOption): NonSharedBuffer;
|
|
1536
|
+
export function realpathSync(path: PathLike, options: BufferEncodingOption): NonSharedBuffer;
|
|
1737
1537
|
/**
|
|
1738
1538
|
* Synchronous realpath(3) - return the canonicalized absolute pathname.
|
|
1739
1539
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1740
1540
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1741
1541
|
*/
|
|
1742
|
-
function realpathSync(path: PathLike, options?: EncodingOption): string | NonSharedBuffer;
|
|
1743
|
-
namespace realpathSync {
|
|
1542
|
+
export function realpathSync(path: PathLike, options?: EncodingOption): string | NonSharedBuffer;
|
|
1543
|
+
export namespace realpathSync {
|
|
1744
1544
|
function native(path: PathLike, options?: EncodingOption): string;
|
|
1745
1545
|
function native(path: PathLike, options: BufferEncodingOption): NonSharedBuffer;
|
|
1746
1546
|
function native(path: PathLike, options?: EncodingOption): string | NonSharedBuffer;
|
|
@@ -1764,8 +1564,8 @@ declare module "node:fs" {
|
|
|
1764
1564
|
* See the POSIX [`unlink(2)`](http://man7.org/linux/man-pages/man2/unlink.2.html) documentation for more details.
|
|
1765
1565
|
* @since v0.0.2
|
|
1766
1566
|
*/
|
|
1767
|
-
function unlink(path: PathLike, callback: NoParamCallback): void;
|
|
1768
|
-
namespace unlink {
|
|
1567
|
+
export function unlink(path: PathLike, callback: NoParamCallback): void;
|
|
1568
|
+
export namespace unlink {
|
|
1769
1569
|
/**
|
|
1770
1570
|
* Asynchronous unlink(2) - delete a name and possibly the file it refers to.
|
|
1771
1571
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -1776,10 +1576,34 @@ declare module "node:fs" {
|
|
|
1776
1576
|
* Synchronous [`unlink(2)`](http://man7.org/linux/man-pages/man2/unlink.2.html). Returns `undefined`.
|
|
1777
1577
|
* @since v0.1.21
|
|
1778
1578
|
*/
|
|
1779
|
-
function unlinkSync(path: PathLike): void;
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1579
|
+
export function unlinkSync(path: PathLike): void;
|
|
1580
|
+
export interface RmDirOptions {
|
|
1581
|
+
/**
|
|
1582
|
+
* If an `EBUSY`, `EMFILE`, `ENFILE`, `ENOTEMPTY`, or
|
|
1583
|
+
* `EPERM` error is encountered, Node.js will retry the operation with a linear
|
|
1584
|
+
* backoff wait of `retryDelay` ms longer on each try. This option represents the
|
|
1585
|
+
* number of retries. This option is ignored if the `recursive` option is not
|
|
1586
|
+
* `true`.
|
|
1587
|
+
* @default 0
|
|
1588
|
+
*/
|
|
1589
|
+
maxRetries?: number | undefined;
|
|
1590
|
+
/**
|
|
1591
|
+
* @deprecated since v14.14.0 In future versions of Node.js and will trigger a warning
|
|
1592
|
+
* `fs.rmdir(path, { recursive: true })` will throw if `path` does not exist or is a file.
|
|
1593
|
+
* Use `fs.rm(path, { recursive: true, force: true })` instead.
|
|
1594
|
+
*
|
|
1595
|
+
* If `true`, perform a recursive directory removal. In
|
|
1596
|
+
* recursive mode, operations are retried on failure.
|
|
1597
|
+
* @default false
|
|
1598
|
+
*/
|
|
1599
|
+
recursive?: boolean | undefined;
|
|
1600
|
+
/**
|
|
1601
|
+
* The amount of time in milliseconds to wait between retries.
|
|
1602
|
+
* This option is ignored if the `recursive` option is not `true`.
|
|
1603
|
+
* @default 100
|
|
1604
|
+
*/
|
|
1605
|
+
retryDelay?: number | undefined;
|
|
1606
|
+
}
|
|
1783
1607
|
/**
|
|
1784
1608
|
* Asynchronous [`rmdir(2)`](http://man7.org/linux/man-pages/man2/rmdir.2.html). No arguments other than a possible exception are given
|
|
1785
1609
|
* to the completion callback.
|
|
@@ -1790,13 +1614,14 @@ declare module "node:fs" {
|
|
|
1790
1614
|
* To get a behavior similar to the `rm -rf` Unix command, use {@link rm} with options `{ recursive: true, force: true }`.
|
|
1791
1615
|
* @since v0.0.2
|
|
1792
1616
|
*/
|
|
1793
|
-
function rmdir(path: PathLike, callback: NoParamCallback): void;
|
|
1794
|
-
|
|
1617
|
+
export function rmdir(path: PathLike, callback: NoParamCallback): void;
|
|
1618
|
+
export function rmdir(path: PathLike, options: RmDirOptions, callback: NoParamCallback): void;
|
|
1619
|
+
export namespace rmdir {
|
|
1795
1620
|
/**
|
|
1796
1621
|
* Asynchronous rmdir(2) - delete a directory.
|
|
1797
1622
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1798
1623
|
*/
|
|
1799
|
-
function __promisify__(path: PathLike): Promise<void>;
|
|
1624
|
+
function __promisify__(path: PathLike, options?: RmDirOptions): Promise<void>;
|
|
1800
1625
|
}
|
|
1801
1626
|
/**
|
|
1802
1627
|
* Synchronous [`rmdir(2)`](http://man7.org/linux/man-pages/man2/rmdir.2.html). Returns `undefined`.
|
|
@@ -1807,8 +1632,8 @@ declare module "node:fs" {
|
|
|
1807
1632
|
* To get a behavior similar to the `rm -rf` Unix command, use {@link rmSync} with options `{ recursive: true, force: true }`.
|
|
1808
1633
|
* @since v0.1.21
|
|
1809
1634
|
*/
|
|
1810
|
-
function rmdirSync(path: PathLike): void;
|
|
1811
|
-
interface RmOptions {
|
|
1635
|
+
export function rmdirSync(path: PathLike, options?: RmDirOptions): void;
|
|
1636
|
+
export interface RmOptions {
|
|
1812
1637
|
/**
|
|
1813
1638
|
* When `true`, exceptions will be ignored if `path` does not exist.
|
|
1814
1639
|
* @default false
|
|
@@ -1841,9 +1666,9 @@ declare module "node:fs" {
|
|
|
1841
1666
|
* completion callback.
|
|
1842
1667
|
* @since v14.14.0
|
|
1843
1668
|
*/
|
|
1844
|
-
function rm(path: PathLike, callback: NoParamCallback): void;
|
|
1845
|
-
function rm(path: PathLike, options: RmOptions, callback: NoParamCallback): void;
|
|
1846
|
-
namespace rm {
|
|
1669
|
+
export function rm(path: PathLike, callback: NoParamCallback): void;
|
|
1670
|
+
export function rm(path: PathLike, options: RmOptions, callback: NoParamCallback): void;
|
|
1671
|
+
export namespace rm {
|
|
1847
1672
|
/**
|
|
1848
1673
|
* Asynchronously removes files and directories (modeled on the standard POSIX `rm` utility).
|
|
1849
1674
|
*/
|
|
@@ -1853,8 +1678,8 @@ declare module "node:fs" {
|
|
|
1853
1678
|
* Synchronously removes files and directories (modeled on the standard POSIX `rm` utility). Returns `undefined`.
|
|
1854
1679
|
* @since v14.14.0
|
|
1855
1680
|
*/
|
|
1856
|
-
function rmSync(path: PathLike, options?: RmOptions): void;
|
|
1857
|
-
interface MakeDirectoryOptions {
|
|
1681
|
+
export function rmSync(path: PathLike, options?: RmOptions): void;
|
|
1682
|
+
export interface MakeDirectoryOptions {
|
|
1858
1683
|
/**
|
|
1859
1684
|
* Indicates whether parent folders should be created.
|
|
1860
1685
|
* If a folder was created, the path to the first created folder will be returned.
|
|
@@ -1903,7 +1728,7 @@ declare module "node:fs" {
|
|
|
1903
1728
|
* See the POSIX [`mkdir(2)`](http://man7.org/linux/man-pages/man2/mkdir.2.html) documentation for more details.
|
|
1904
1729
|
* @since v0.1.8
|
|
1905
1730
|
*/
|
|
1906
|
-
function mkdir(
|
|
1731
|
+
export function mkdir(
|
|
1907
1732
|
path: PathLike,
|
|
1908
1733
|
options: MakeDirectoryOptions & {
|
|
1909
1734
|
recursive: true;
|
|
@@ -1916,7 +1741,7 @@ declare module "node:fs" {
|
|
|
1916
1741
|
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
|
|
1917
1742
|
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
|
|
1918
1743
|
*/
|
|
1919
|
-
function mkdir(
|
|
1744
|
+
export function mkdir(
|
|
1920
1745
|
path: PathLike,
|
|
1921
1746
|
options:
|
|
1922
1747
|
| Mode
|
|
@@ -1933,7 +1758,7 @@ declare module "node:fs" {
|
|
|
1933
1758
|
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
|
|
1934
1759
|
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
|
|
1935
1760
|
*/
|
|
1936
|
-
function mkdir(
|
|
1761
|
+
export function mkdir(
|
|
1937
1762
|
path: PathLike,
|
|
1938
1763
|
options: Mode | MakeDirectoryOptions | null | undefined,
|
|
1939
1764
|
callback: (err: NodeJS.ErrnoException | null, path?: string) => void,
|
|
@@ -1942,8 +1767,8 @@ declare module "node:fs" {
|
|
|
1942
1767
|
* Asynchronous mkdir(2) - create a directory with a mode of `0o777`.
|
|
1943
1768
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1944
1769
|
*/
|
|
1945
|
-
function mkdir(path: PathLike, callback: NoParamCallback): void;
|
|
1946
|
-
namespace mkdir {
|
|
1770
|
+
export function mkdir(path: PathLike, callback: NoParamCallback): void;
|
|
1771
|
+
export namespace mkdir {
|
|
1947
1772
|
/**
|
|
1948
1773
|
* Asynchronous mkdir(2) - create a directory.
|
|
1949
1774
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -1989,7 +1814,7 @@ declare module "node:fs" {
|
|
|
1989
1814
|
* See the POSIX [`mkdir(2)`](http://man7.org/linux/man-pages/man2/mkdir.2.html) documentation for more details.
|
|
1990
1815
|
* @since v0.1.21
|
|
1991
1816
|
*/
|
|
1992
|
-
function mkdirSync(
|
|
1817
|
+
export function mkdirSync(
|
|
1993
1818
|
path: PathLike,
|
|
1994
1819
|
options: MakeDirectoryOptions & {
|
|
1995
1820
|
recursive: true;
|
|
@@ -2001,7 +1826,7 @@ declare module "node:fs" {
|
|
|
2001
1826
|
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
|
|
2002
1827
|
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
|
|
2003
1828
|
*/
|
|
2004
|
-
function mkdirSync(
|
|
1829
|
+
export function mkdirSync(
|
|
2005
1830
|
path: PathLike,
|
|
2006
1831
|
options?:
|
|
2007
1832
|
| Mode
|
|
@@ -2016,7 +1841,7 @@ declare module "node:fs" {
|
|
|
2016
1841
|
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
|
|
2017
1842
|
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
|
|
2018
1843
|
*/
|
|
2019
|
-
function mkdirSync(path: PathLike, options?: Mode | MakeDirectoryOptions | null): string | undefined;
|
|
1844
|
+
export function mkdirSync(path: PathLike, options?: Mode | MakeDirectoryOptions | null): string | undefined;
|
|
2020
1845
|
/**
|
|
2021
1846
|
* Creates a unique temporary directory.
|
|
2022
1847
|
*
|
|
@@ -2076,7 +1901,7 @@ declare module "node:fs" {
|
|
|
2076
1901
|
* ```
|
|
2077
1902
|
* @since v5.10.0
|
|
2078
1903
|
*/
|
|
2079
|
-
function mkdtemp(
|
|
1904
|
+
export function mkdtemp(
|
|
2080
1905
|
prefix: string,
|
|
2081
1906
|
options: EncodingOption,
|
|
2082
1907
|
callback: (err: NodeJS.ErrnoException | null, folder: string) => void,
|
|
@@ -2086,7 +1911,7 @@ declare module "node:fs" {
|
|
|
2086
1911
|
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
|
2087
1912
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
2088
1913
|
*/
|
|
2089
|
-
function mkdtemp(
|
|
1914
|
+
export function mkdtemp(
|
|
2090
1915
|
prefix: string,
|
|
2091
1916
|
options: BufferEncodingOption,
|
|
2092
1917
|
callback: (err: NodeJS.ErrnoException | null, folder: NonSharedBuffer) => void,
|
|
@@ -2096,7 +1921,7 @@ declare module "node:fs" {
|
|
|
2096
1921
|
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
|
2097
1922
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
2098
1923
|
*/
|
|
2099
|
-
function mkdtemp(
|
|
1924
|
+
export function mkdtemp(
|
|
2100
1925
|
prefix: string,
|
|
2101
1926
|
options: EncodingOption,
|
|
2102
1927
|
callback: (err: NodeJS.ErrnoException | null, folder: string | NonSharedBuffer) => void,
|
|
@@ -2105,11 +1930,11 @@ declare module "node:fs" {
|
|
|
2105
1930
|
* Asynchronously creates a unique temporary directory.
|
|
2106
1931
|
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
|
2107
1932
|
*/
|
|
2108
|
-
function mkdtemp(
|
|
1933
|
+
export function mkdtemp(
|
|
2109
1934
|
prefix: string,
|
|
2110
1935
|
callback: (err: NodeJS.ErrnoException | null, folder: string) => void,
|
|
2111
1936
|
): void;
|
|
2112
|
-
namespace mkdtemp {
|
|
1937
|
+
export namespace mkdtemp {
|
|
2113
1938
|
/**
|
|
2114
1939
|
* Asynchronously creates a unique temporary directory.
|
|
2115
1940
|
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
|
@@ -2139,52 +1964,19 @@ declare module "node:fs" {
|
|
|
2139
1964
|
* object with an `encoding` property specifying the character encoding to use.
|
|
2140
1965
|
* @since v5.10.0
|
|
2141
1966
|
*/
|
|
2142
|
-
function mkdtempSync(prefix: string, options?: EncodingOption): string;
|
|
1967
|
+
export function mkdtempSync(prefix: string, options?: EncodingOption): string;
|
|
2143
1968
|
/**
|
|
2144
1969
|
* Synchronously creates a unique temporary directory.
|
|
2145
1970
|
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
|
2146
1971
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
2147
1972
|
*/
|
|
2148
|
-
function mkdtempSync(prefix: string, options: BufferEncodingOption): NonSharedBuffer;
|
|
1973
|
+
export function mkdtempSync(prefix: string, options: BufferEncodingOption): NonSharedBuffer;
|
|
2149
1974
|
/**
|
|
2150
1975
|
* Synchronously creates a unique temporary directory.
|
|
2151
1976
|
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
|
2152
1977
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
2153
1978
|
*/
|
|
2154
|
-
function mkdtempSync(prefix: string, options?: EncodingOption): string | NonSharedBuffer;
|
|
2155
|
-
interface DisposableTempDir extends Disposable {
|
|
2156
|
-
/**
|
|
2157
|
-
* The path of the created directory.
|
|
2158
|
-
*/
|
|
2159
|
-
path: string;
|
|
2160
|
-
/**
|
|
2161
|
-
* A function which removes the created directory.
|
|
2162
|
-
*/
|
|
2163
|
-
remove(): void;
|
|
2164
|
-
/**
|
|
2165
|
-
* The same as `remove`.
|
|
2166
|
-
*/
|
|
2167
|
-
[Symbol.dispose](): void;
|
|
2168
|
-
}
|
|
2169
|
-
/**
|
|
2170
|
-
* Returns a disposable object whose `path` property holds the created directory
|
|
2171
|
-
* path. When the object is disposed, the directory and its contents will be
|
|
2172
|
-
* removed if it still exists. If the directory cannot be deleted, disposal will
|
|
2173
|
-
* throw an error. The object has a `remove()` method which will perform the same
|
|
2174
|
-
* task.
|
|
2175
|
-
*
|
|
2176
|
-
* <!-- TODO: link MDN docs for disposables once https://github.com/mdn/content/pull/38027 lands -->
|
|
2177
|
-
*
|
|
2178
|
-
* For detailed information, see the documentation of `fs.mkdtemp()`.
|
|
2179
|
-
*
|
|
2180
|
-
* There is no callback-based version of this API because it is designed for use
|
|
2181
|
-
* with the `using` syntax.
|
|
2182
|
-
*
|
|
2183
|
-
* The optional `options` argument can be a string specifying an encoding, or an
|
|
2184
|
-
* object with an `encoding` property specifying the character encoding to use.
|
|
2185
|
-
* @since v24.4.0
|
|
2186
|
-
*/
|
|
2187
|
-
function mkdtempDisposableSync(prefix: string, options?: EncodingOption): DisposableTempDir;
|
|
1979
|
+
export function mkdtempSync(prefix: string, options?: EncodingOption): string | NonSharedBuffer;
|
|
2188
1980
|
/**
|
|
2189
1981
|
* 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 `'..'`.
|
|
2190
1982
|
*
|
|
@@ -2198,7 +1990,7 @@ declare module "node:fs" {
|
|
|
2198
1990
|
* If `options.withFileTypes` is set to `true`, the `files` array will contain `fs.Dirent` objects.
|
|
2199
1991
|
* @since v0.1.8
|
|
2200
1992
|
*/
|
|
2201
|
-
function readdir(
|
|
1993
|
+
export function readdir(
|
|
2202
1994
|
path: PathLike,
|
|
2203
1995
|
options:
|
|
2204
1996
|
| {
|
|
@@ -2216,7 +2008,7 @@ declare module "node:fs" {
|
|
|
2216
2008
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2217
2009
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
2218
2010
|
*/
|
|
2219
|
-
function readdir(
|
|
2011
|
+
export function readdir(
|
|
2220
2012
|
path: PathLike,
|
|
2221
2013
|
options:
|
|
2222
2014
|
| {
|
|
@@ -2232,7 +2024,7 @@ declare module "node:fs" {
|
|
|
2232
2024
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2233
2025
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
2234
2026
|
*/
|
|
2235
|
-
function readdir(
|
|
2027
|
+
export function readdir(
|
|
2236
2028
|
path: PathLike,
|
|
2237
2029
|
options:
|
|
2238
2030
|
| (ObjectEncodingOptions & {
|
|
@@ -2248,7 +2040,7 @@ declare module "node:fs" {
|
|
|
2248
2040
|
* Asynchronous readdir(3) - read a directory.
|
|
2249
2041
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2250
2042
|
*/
|
|
2251
|
-
function readdir(
|
|
2043
|
+
export function readdir(
|
|
2252
2044
|
path: PathLike,
|
|
2253
2045
|
callback: (err: NodeJS.ErrnoException | null, files: string[]) => void,
|
|
2254
2046
|
): void;
|
|
@@ -2257,7 +2049,7 @@ declare module "node:fs" {
|
|
|
2257
2049
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2258
2050
|
* @param options If called with `withFileTypes: true` the result data will be an array of Dirent.
|
|
2259
2051
|
*/
|
|
2260
|
-
function readdir(
|
|
2052
|
+
export function readdir(
|
|
2261
2053
|
path: PathLike,
|
|
2262
2054
|
options: ObjectEncodingOptions & {
|
|
2263
2055
|
withFileTypes: true;
|
|
@@ -2270,7 +2062,7 @@ declare module "node:fs" {
|
|
|
2270
2062
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2271
2063
|
* @param options Must include `withFileTypes: true` and `encoding: 'buffer'`.
|
|
2272
2064
|
*/
|
|
2273
|
-
function readdir(
|
|
2065
|
+
export function readdir(
|
|
2274
2066
|
path: PathLike,
|
|
2275
2067
|
options: {
|
|
2276
2068
|
encoding: "buffer";
|
|
@@ -2279,7 +2071,7 @@ declare module "node:fs" {
|
|
|
2279
2071
|
},
|
|
2280
2072
|
callback: (err: NodeJS.ErrnoException | null, files: Dirent<NonSharedBuffer>[]) => void,
|
|
2281
2073
|
): void;
|
|
2282
|
-
namespace readdir {
|
|
2074
|
+
export namespace readdir {
|
|
2283
2075
|
/**
|
|
2284
2076
|
* Asynchronous readdir(3) - read a directory.
|
|
2285
2077
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -2365,7 +2157,7 @@ declare module "node:fs" {
|
|
|
2365
2157
|
* If `options.withFileTypes` is set to `true`, the result will contain `fs.Dirent` objects.
|
|
2366
2158
|
* @since v0.1.21
|
|
2367
2159
|
*/
|
|
2368
|
-
function readdirSync(
|
|
2160
|
+
export function readdirSync(
|
|
2369
2161
|
path: PathLike,
|
|
2370
2162
|
options?:
|
|
2371
2163
|
| {
|
|
@@ -2381,7 +2173,7 @@ declare module "node:fs" {
|
|
|
2381
2173
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2382
2174
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
2383
2175
|
*/
|
|
2384
|
-
function readdirSync(
|
|
2176
|
+
export function readdirSync(
|
|
2385
2177
|
path: PathLike,
|
|
2386
2178
|
options:
|
|
2387
2179
|
| {
|
|
@@ -2396,7 +2188,7 @@ declare module "node:fs" {
|
|
|
2396
2188
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2397
2189
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
2398
2190
|
*/
|
|
2399
|
-
function readdirSync(
|
|
2191
|
+
export function readdirSync(
|
|
2400
2192
|
path: PathLike,
|
|
2401
2193
|
options?:
|
|
2402
2194
|
| (ObjectEncodingOptions & {
|
|
@@ -2411,7 +2203,7 @@ declare module "node:fs" {
|
|
|
2411
2203
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2412
2204
|
* @param options If called with `withFileTypes: true` the result data will be an array of Dirent.
|
|
2413
2205
|
*/
|
|
2414
|
-
function readdirSync(
|
|
2206
|
+
export function readdirSync(
|
|
2415
2207
|
path: PathLike,
|
|
2416
2208
|
options: ObjectEncodingOptions & {
|
|
2417
2209
|
withFileTypes: true;
|
|
@@ -2423,7 +2215,7 @@ declare module "node:fs" {
|
|
|
2423
2215
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2424
2216
|
* @param options Must include `withFileTypes: true` and `encoding: 'buffer'`.
|
|
2425
2217
|
*/
|
|
2426
|
-
function readdirSync(
|
|
2218
|
+
export function readdirSync(
|
|
2427
2219
|
path: PathLike,
|
|
2428
2220
|
options: {
|
|
2429
2221
|
encoding: "buffer";
|
|
@@ -2441,8 +2233,8 @@ declare module "node:fs" {
|
|
|
2441
2233
|
* See the POSIX [`close(2)`](http://man7.org/linux/man-pages/man2/close.2.html) documentation for more detail.
|
|
2442
2234
|
* @since v0.0.2
|
|
2443
2235
|
*/
|
|
2444
|
-
function close(fd: number, callback?: NoParamCallback): void;
|
|
2445
|
-
namespace close {
|
|
2236
|
+
export function close(fd: number, callback?: NoParamCallback): void;
|
|
2237
|
+
export namespace close {
|
|
2446
2238
|
/**
|
|
2447
2239
|
* Asynchronous close(2) - close a file descriptor.
|
|
2448
2240
|
* @param fd A file descriptor.
|
|
@@ -2458,7 +2250,7 @@ declare module "node:fs" {
|
|
|
2458
2250
|
* See the POSIX [`close(2)`](http://man7.org/linux/man-pages/man2/close.2.html) documentation for more detail.
|
|
2459
2251
|
* @since v0.1.21
|
|
2460
2252
|
*/
|
|
2461
|
-
function closeSync(fd: number): void;
|
|
2253
|
+
export function closeSync(fd: number): void;
|
|
2462
2254
|
/**
|
|
2463
2255
|
* Asynchronous file open. See the POSIX [`open(2)`](http://man7.org/linux/man-pages/man2/open.2.html) documentation for more details.
|
|
2464
2256
|
*
|
|
@@ -2476,7 +2268,7 @@ declare module "node:fs" {
|
|
|
2476
2268
|
* @param [flags='r'] See `support of file system `flags``.
|
|
2477
2269
|
* @param [mode=0o666]
|
|
2478
2270
|
*/
|
|
2479
|
-
function open(
|
|
2271
|
+
export function open(
|
|
2480
2272
|
path: PathLike,
|
|
2481
2273
|
flags: OpenMode | undefined,
|
|
2482
2274
|
mode: Mode | undefined | null,
|
|
@@ -2487,7 +2279,7 @@ declare module "node:fs" {
|
|
|
2487
2279
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2488
2280
|
* @param [flags='r'] See `support of file system `flags``.
|
|
2489
2281
|
*/
|
|
2490
|
-
function open(
|
|
2282
|
+
export function open(
|
|
2491
2283
|
path: PathLike,
|
|
2492
2284
|
flags: OpenMode | undefined,
|
|
2493
2285
|
callback: (err: NodeJS.ErrnoException | null, fd: number) => void,
|
|
@@ -2496,8 +2288,8 @@ declare module "node:fs" {
|
|
|
2496
2288
|
* Asynchronous open(2) - open and possibly create a file. If the file is created, its mode will be `0o666`.
|
|
2497
2289
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2498
2290
|
*/
|
|
2499
|
-
function open(path: PathLike, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void;
|
|
2500
|
-
namespace open {
|
|
2291
|
+
export function open(path: PathLike, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void;
|
|
2292
|
+
export namespace open {
|
|
2501
2293
|
/**
|
|
2502
2294
|
* Asynchronous open(2) - open and possibly create a file.
|
|
2503
2295
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -2514,7 +2306,7 @@ declare module "node:fs" {
|
|
|
2514
2306
|
* @param [flags='r']
|
|
2515
2307
|
* @param [mode=0o666]
|
|
2516
2308
|
*/
|
|
2517
|
-
function openSync(path: PathLike, flags: OpenMode, mode?: Mode | null): number;
|
|
2309
|
+
export function openSync(path: PathLike, flags: OpenMode, mode?: Mode | null): number;
|
|
2518
2310
|
/**
|
|
2519
2311
|
* Change the file system timestamps of the object referenced by `path`.
|
|
2520
2312
|
*
|
|
@@ -2524,8 +2316,8 @@ declare module "node:fs" {
|
|
|
2524
2316
|
* * If the value can not be converted to a number, or is `NaN`, `Infinity`, or `-Infinity`, an `Error` will be thrown.
|
|
2525
2317
|
* @since v0.4.2
|
|
2526
2318
|
*/
|
|
2527
|
-
function utimes(path: PathLike, atime: TimeLike, mtime: TimeLike, callback: NoParamCallback): void;
|
|
2528
|
-
namespace utimes {
|
|
2319
|
+
export function utimes(path: PathLike, atime: TimeLike, mtime: TimeLike, callback: NoParamCallback): void;
|
|
2320
|
+
export namespace utimes {
|
|
2529
2321
|
/**
|
|
2530
2322
|
* Asynchronously change file timestamps of the file referenced by the supplied path.
|
|
2531
2323
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -2541,14 +2333,14 @@ declare module "node:fs" {
|
|
|
2541
2333
|
* this API: {@link utimes}.
|
|
2542
2334
|
* @since v0.4.2
|
|
2543
2335
|
*/
|
|
2544
|
-
function utimesSync(path: PathLike, atime: TimeLike, mtime: TimeLike): void;
|
|
2336
|
+
export function utimesSync(path: PathLike, atime: TimeLike, mtime: TimeLike): void;
|
|
2545
2337
|
/**
|
|
2546
2338
|
* Change the file system timestamps of the object referenced by the supplied file
|
|
2547
2339
|
* descriptor. See {@link utimes}.
|
|
2548
2340
|
* @since v0.4.2
|
|
2549
2341
|
*/
|
|
2550
|
-
function futimes(fd: number, atime: TimeLike, mtime: TimeLike, callback: NoParamCallback): void;
|
|
2551
|
-
namespace futimes {
|
|
2342
|
+
export function futimes(fd: number, atime: TimeLike, mtime: TimeLike, callback: NoParamCallback): void;
|
|
2343
|
+
export namespace futimes {
|
|
2552
2344
|
/**
|
|
2553
2345
|
* Asynchronously change file timestamps of the file referenced by the supplied file descriptor.
|
|
2554
2346
|
* @param fd A file descriptor.
|
|
@@ -2561,7 +2353,7 @@ declare module "node:fs" {
|
|
|
2561
2353
|
* Synchronous version of {@link futimes}. Returns `undefined`.
|
|
2562
2354
|
* @since v0.4.2
|
|
2563
2355
|
*/
|
|
2564
|
-
function futimesSync(fd: number, atime: TimeLike, mtime: TimeLike): void;
|
|
2356
|
+
export function futimesSync(fd: number, atime: TimeLike, mtime: TimeLike): void;
|
|
2565
2357
|
/**
|
|
2566
2358
|
* Request that all data for the open file descriptor is flushed to the storage
|
|
2567
2359
|
* device. The specific implementation is operating system and device specific.
|
|
@@ -2569,8 +2361,8 @@ declare module "node:fs" {
|
|
|
2569
2361
|
* than a possible exception are given to the completion callback.
|
|
2570
2362
|
* @since v0.1.96
|
|
2571
2363
|
*/
|
|
2572
|
-
function fsync(fd: number, callback: NoParamCallback): void;
|
|
2573
|
-
namespace fsync {
|
|
2364
|
+
export function fsync(fd: number, callback: NoParamCallback): void;
|
|
2365
|
+
export namespace fsync {
|
|
2574
2366
|
/**
|
|
2575
2367
|
* Asynchronous fsync(2) - synchronize a file's in-core state with the underlying storage device.
|
|
2576
2368
|
* @param fd A file descriptor.
|
|
@@ -2583,8 +2375,8 @@ declare module "node:fs" {
|
|
|
2583
2375
|
* Refer to the POSIX [`fsync(2)`](http://man7.org/linux/man-pages/man2/fsync.2.html) documentation for more detail. Returns `undefined`.
|
|
2584
2376
|
* @since v0.1.96
|
|
2585
2377
|
*/
|
|
2586
|
-
function fsyncSync(fd: number): void;
|
|
2587
|
-
interface WriteOptions {
|
|
2378
|
+
export function fsyncSync(fd: number): void;
|
|
2379
|
+
export interface WriteOptions {
|
|
2588
2380
|
/**
|
|
2589
2381
|
* @default 0
|
|
2590
2382
|
*/
|
|
@@ -2625,7 +2417,7 @@ declare module "node:fs" {
|
|
|
2625
2417
|
* @param [length=buffer.byteLength - offset]
|
|
2626
2418
|
* @param [position='null']
|
|
2627
2419
|
*/
|
|
2628
|
-
function write<TBuffer extends NodeJS.ArrayBufferView>(
|
|
2420
|
+
export function write<TBuffer extends NodeJS.ArrayBufferView>(
|
|
2629
2421
|
fd: number,
|
|
2630
2422
|
buffer: TBuffer,
|
|
2631
2423
|
offset: number | undefined | null,
|
|
@@ -2639,7 +2431,7 @@ declare module "node:fs" {
|
|
|
2639
2431
|
* @param offset The part of the buffer to be written. If not supplied, defaults to `0`.
|
|
2640
2432
|
* @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`.
|
|
2641
2433
|
*/
|
|
2642
|
-
function write<TBuffer extends NodeJS.ArrayBufferView>(
|
|
2434
|
+
export function write<TBuffer extends NodeJS.ArrayBufferView>(
|
|
2643
2435
|
fd: number,
|
|
2644
2436
|
buffer: TBuffer,
|
|
2645
2437
|
offset: number | undefined | null,
|
|
@@ -2651,7 +2443,7 @@ declare module "node:fs" {
|
|
|
2651
2443
|
* @param fd A file descriptor.
|
|
2652
2444
|
* @param offset The part of the buffer to be written. If not supplied, defaults to `0`.
|
|
2653
2445
|
*/
|
|
2654
|
-
function write<TBuffer extends NodeJS.ArrayBufferView>(
|
|
2446
|
+
export function write<TBuffer extends NodeJS.ArrayBufferView>(
|
|
2655
2447
|
fd: number,
|
|
2656
2448
|
buffer: TBuffer,
|
|
2657
2449
|
offset: number | undefined | null,
|
|
@@ -2661,7 +2453,7 @@ declare module "node:fs" {
|
|
|
2661
2453
|
* Asynchronously writes `buffer` to the file referenced by the supplied file descriptor.
|
|
2662
2454
|
* @param fd A file descriptor.
|
|
2663
2455
|
*/
|
|
2664
|
-
function write<TBuffer extends NodeJS.ArrayBufferView>(
|
|
2456
|
+
export function write<TBuffer extends NodeJS.ArrayBufferView>(
|
|
2665
2457
|
fd: number,
|
|
2666
2458
|
buffer: TBuffer,
|
|
2667
2459
|
callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void,
|
|
@@ -2674,7 +2466,7 @@ declare module "node:fs" {
|
|
|
2674
2466
|
* * `length` The number of bytes to write. If not supplied, defaults to `buffer.length - offset`.
|
|
2675
2467
|
* * `position` The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
|
|
2676
2468
|
*/
|
|
2677
|
-
function write<TBuffer extends NodeJS.ArrayBufferView>(
|
|
2469
|
+
export function write<TBuffer extends NodeJS.ArrayBufferView>(
|
|
2678
2470
|
fd: number,
|
|
2679
2471
|
buffer: TBuffer,
|
|
2680
2472
|
options: WriteOptions,
|
|
@@ -2687,7 +2479,7 @@ declare module "node:fs" {
|
|
|
2687
2479
|
* @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
|
|
2688
2480
|
* @param encoding The expected string encoding.
|
|
2689
2481
|
*/
|
|
2690
|
-
function write(
|
|
2482
|
+
export function write(
|
|
2691
2483
|
fd: number,
|
|
2692
2484
|
string: string,
|
|
2693
2485
|
position: number | undefined | null,
|
|
@@ -2700,7 +2492,7 @@ declare module "node:fs" {
|
|
|
2700
2492
|
* @param string A string to write.
|
|
2701
2493
|
* @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
|
|
2702
2494
|
*/
|
|
2703
|
-
function write(
|
|
2495
|
+
export function write(
|
|
2704
2496
|
fd: number,
|
|
2705
2497
|
string: string,
|
|
2706
2498
|
position: number | undefined | null,
|
|
@@ -2711,12 +2503,12 @@ declare module "node:fs" {
|
|
|
2711
2503
|
* @param fd A file descriptor.
|
|
2712
2504
|
* @param string A string to write.
|
|
2713
2505
|
*/
|
|
2714
|
-
function write(
|
|
2506
|
+
export function write(
|
|
2715
2507
|
fd: number,
|
|
2716
2508
|
string: string,
|
|
2717
2509
|
callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void,
|
|
2718
2510
|
): void;
|
|
2719
|
-
namespace write {
|
|
2511
|
+
export namespace write {
|
|
2720
2512
|
/**
|
|
2721
2513
|
* Asynchronously writes `buffer` to the file referenced by the supplied file descriptor.
|
|
2722
2514
|
* @param fd A file descriptor.
|
|
@@ -2776,7 +2568,7 @@ declare module "node:fs" {
|
|
|
2776
2568
|
* @param [position='null']
|
|
2777
2569
|
* @return The number of bytes written.
|
|
2778
2570
|
*/
|
|
2779
|
-
function writeSync(
|
|
2571
|
+
export function writeSync(
|
|
2780
2572
|
fd: number,
|
|
2781
2573
|
buffer: NodeJS.ArrayBufferView,
|
|
2782
2574
|
offset?: number | null,
|
|
@@ -2790,14 +2582,14 @@ declare module "node:fs" {
|
|
|
2790
2582
|
* @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
|
|
2791
2583
|
* @param encoding The expected string encoding.
|
|
2792
2584
|
*/
|
|
2793
|
-
function writeSync(
|
|
2585
|
+
export function writeSync(
|
|
2794
2586
|
fd: number,
|
|
2795
2587
|
string: string,
|
|
2796
2588
|
position?: number | null,
|
|
2797
2589
|
encoding?: BufferEncoding | null,
|
|
2798
2590
|
): number;
|
|
2799
|
-
type ReadPosition = number | bigint;
|
|
2800
|
-
interface ReadOptions {
|
|
2591
|
+
export type ReadPosition = number | bigint;
|
|
2592
|
+
export interface ReadOptions {
|
|
2801
2593
|
/**
|
|
2802
2594
|
* @default 0
|
|
2803
2595
|
*/
|
|
@@ -2811,15 +2603,15 @@ declare module "node:fs" {
|
|
|
2811
2603
|
*/
|
|
2812
2604
|
position?: ReadPosition | null | undefined;
|
|
2813
2605
|
}
|
|
2814
|
-
interface ReadOptionsWithBuffer<T extends NodeJS.ArrayBufferView> extends ReadOptions {
|
|
2606
|
+
export interface ReadOptionsWithBuffer<T extends NodeJS.ArrayBufferView> extends ReadOptions {
|
|
2815
2607
|
buffer?: T | undefined;
|
|
2816
2608
|
}
|
|
2817
2609
|
/** @deprecated Use `ReadOptions` instead. */
|
|
2818
2610
|
// TODO: remove in future major
|
|
2819
|
-
interface ReadSyncOptions extends ReadOptions {}
|
|
2611
|
+
export interface ReadSyncOptions extends ReadOptions {}
|
|
2820
2612
|
/** @deprecated Use `ReadOptionsWithBuffer` instead. */
|
|
2821
2613
|
// TODO: remove in future major
|
|
2822
|
-
interface ReadAsyncOptions<T extends NodeJS.ArrayBufferView> extends ReadOptionsWithBuffer<T> {}
|
|
2614
|
+
export interface ReadAsyncOptions<T extends NodeJS.ArrayBufferView> extends ReadOptionsWithBuffer<T> {}
|
|
2823
2615
|
/**
|
|
2824
2616
|
* Read data from the file specified by `fd`.
|
|
2825
2617
|
*
|
|
@@ -2837,7 +2629,7 @@ declare module "node:fs" {
|
|
|
2837
2629
|
* @param position Specifies where to begin reading from in the file. If `position` is `null` or `-1 `, data will be read from the current file position, and the file position will be updated. If
|
|
2838
2630
|
* `position` is an integer, the file position will be unchanged.
|
|
2839
2631
|
*/
|
|
2840
|
-
function read<TBuffer extends NodeJS.ArrayBufferView>(
|
|
2632
|
+
export function read<TBuffer extends NodeJS.ArrayBufferView>(
|
|
2841
2633
|
fd: number,
|
|
2842
2634
|
buffer: TBuffer,
|
|
2843
2635
|
offset: number,
|
|
@@ -2854,27 +2646,27 @@ declare module "node:fs" {
|
|
|
2854
2646
|
* `position` defaults to `null`
|
|
2855
2647
|
* @since v12.17.0, 13.11.0
|
|
2856
2648
|
*/
|
|
2857
|
-
function read<TBuffer extends NodeJS.ArrayBufferView = NonSharedBuffer>(
|
|
2649
|
+
export function read<TBuffer extends NodeJS.ArrayBufferView = NonSharedBuffer>(
|
|
2858
2650
|
fd: number,
|
|
2859
2651
|
options: ReadOptionsWithBuffer<TBuffer>,
|
|
2860
2652
|
callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void,
|
|
2861
2653
|
): void;
|
|
2862
|
-
function read<TBuffer extends NodeJS.ArrayBufferView>(
|
|
2654
|
+
export function read<TBuffer extends NodeJS.ArrayBufferView>(
|
|
2863
2655
|
fd: number,
|
|
2864
2656
|
buffer: TBuffer,
|
|
2865
2657
|
options: ReadOptions,
|
|
2866
2658
|
callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void,
|
|
2867
2659
|
): void;
|
|
2868
|
-
function read<TBuffer extends NodeJS.ArrayBufferView>(
|
|
2660
|
+
export function read<TBuffer extends NodeJS.ArrayBufferView>(
|
|
2869
2661
|
fd: number,
|
|
2870
2662
|
buffer: TBuffer,
|
|
2871
2663
|
callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void,
|
|
2872
2664
|
): void;
|
|
2873
|
-
function read(
|
|
2665
|
+
export function read(
|
|
2874
2666
|
fd: number,
|
|
2875
2667
|
callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: NonSharedBuffer) => void,
|
|
2876
2668
|
): void;
|
|
2877
|
-
namespace read {
|
|
2669
|
+
export namespace read {
|
|
2878
2670
|
/**
|
|
2879
2671
|
* @param fd A file descriptor.
|
|
2880
2672
|
* @param buffer The buffer that the data will be written to.
|
|
@@ -2912,7 +2704,7 @@ declare module "node:fs" {
|
|
|
2912
2704
|
* @since v0.1.21
|
|
2913
2705
|
* @param [position='null']
|
|
2914
2706
|
*/
|
|
2915
|
-
function readSync(
|
|
2707
|
+
export function readSync(
|
|
2916
2708
|
fd: number,
|
|
2917
2709
|
buffer: NodeJS.ArrayBufferView,
|
|
2918
2710
|
offset: number,
|
|
@@ -2923,7 +2715,7 @@ declare module "node:fs" {
|
|
|
2923
2715
|
* Similar to the above `fs.readSync` function, this version takes an optional `options` object.
|
|
2924
2716
|
* If no `options` object is specified, it will default with the above values.
|
|
2925
2717
|
*/
|
|
2926
|
-
function readSync(fd: number, buffer: NodeJS.ArrayBufferView, opts?: ReadOptions): number;
|
|
2718
|
+
export function readSync(fd: number, buffer: NodeJS.ArrayBufferView, opts?: ReadOptions): number;
|
|
2927
2719
|
/**
|
|
2928
2720
|
* Asynchronously reads the entire contents of a file.
|
|
2929
2721
|
*
|
|
@@ -2990,7 +2782,7 @@ declare module "node:fs" {
|
|
|
2990
2782
|
* @since v0.1.29
|
|
2991
2783
|
* @param path filename or file descriptor
|
|
2992
2784
|
*/
|
|
2993
|
-
function readFile(
|
|
2785
|
+
export function readFile(
|
|
2994
2786
|
path: PathOrFileDescriptor,
|
|
2995
2787
|
options:
|
|
2996
2788
|
| ({
|
|
@@ -3008,7 +2800,7 @@ declare module "node:fs" {
|
|
|
3008
2800
|
* @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
|
|
3009
2801
|
* If a flag is not provided, it defaults to `'r'`.
|
|
3010
2802
|
*/
|
|
3011
|
-
function readFile(
|
|
2803
|
+
export function readFile(
|
|
3012
2804
|
path: PathOrFileDescriptor,
|
|
3013
2805
|
options:
|
|
3014
2806
|
| ({
|
|
@@ -3025,7 +2817,7 @@ declare module "node:fs" {
|
|
|
3025
2817
|
* @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
|
|
3026
2818
|
* If a flag is not provided, it defaults to `'r'`.
|
|
3027
2819
|
*/
|
|
3028
|
-
function readFile(
|
|
2820
|
+
export function readFile(
|
|
3029
2821
|
path: PathOrFileDescriptor,
|
|
3030
2822
|
options:
|
|
3031
2823
|
| (ObjectEncodingOptions & {
|
|
@@ -3041,11 +2833,11 @@ declare module "node:fs" {
|
|
|
3041
2833
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
3042
2834
|
* If a file descriptor is provided, the underlying file will _not_ be closed automatically.
|
|
3043
2835
|
*/
|
|
3044
|
-
function readFile(
|
|
2836
|
+
export function readFile(
|
|
3045
2837
|
path: PathOrFileDescriptor,
|
|
3046
2838
|
callback: (err: NodeJS.ErrnoException | null, data: NonSharedBuffer) => void,
|
|
3047
2839
|
): void;
|
|
3048
|
-
namespace readFile {
|
|
2840
|
+
export namespace readFile {
|
|
3049
2841
|
/**
|
|
3050
2842
|
* Asynchronously reads the entire contents of a file.
|
|
3051
2843
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -3119,7 +2911,7 @@ declare module "node:fs" {
|
|
|
3119
2911
|
* @since v0.1.8
|
|
3120
2912
|
* @param path filename or file descriptor
|
|
3121
2913
|
*/
|
|
3122
|
-
function readFileSync(
|
|
2914
|
+
export function readFileSync(
|
|
3123
2915
|
path: PathOrFileDescriptor,
|
|
3124
2916
|
options?: {
|
|
3125
2917
|
encoding?: null | undefined;
|
|
@@ -3133,7 +2925,7 @@ declare module "node:fs" {
|
|
|
3133
2925
|
* @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
|
|
3134
2926
|
* If a flag is not provided, it defaults to `'r'`.
|
|
3135
2927
|
*/
|
|
3136
|
-
function readFileSync(
|
|
2928
|
+
export function readFileSync(
|
|
3137
2929
|
path: PathOrFileDescriptor,
|
|
3138
2930
|
options:
|
|
3139
2931
|
| {
|
|
@@ -3149,7 +2941,7 @@ declare module "node:fs" {
|
|
|
3149
2941
|
* @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
|
|
3150
2942
|
* If a flag is not provided, it defaults to `'r'`.
|
|
3151
2943
|
*/
|
|
3152
|
-
function readFileSync(
|
|
2944
|
+
export function readFileSync(
|
|
3153
2945
|
path: PathOrFileDescriptor,
|
|
3154
2946
|
options?:
|
|
3155
2947
|
| (ObjectEncodingOptions & {
|
|
@@ -3158,7 +2950,7 @@ declare module "node:fs" {
|
|
|
3158
2950
|
| BufferEncoding
|
|
3159
2951
|
| null,
|
|
3160
2952
|
): string | NonSharedBuffer;
|
|
3161
|
-
type WriteFileOptions =
|
|
2953
|
+
export type WriteFileOptions =
|
|
3162
2954
|
| (
|
|
3163
2955
|
& ObjectEncodingOptions
|
|
3164
2956
|
& Abortable
|
|
@@ -3231,7 +3023,7 @@ declare module "node:fs" {
|
|
|
3231
3023
|
* @since v0.1.29
|
|
3232
3024
|
* @param file filename or file descriptor
|
|
3233
3025
|
*/
|
|
3234
|
-
function writeFile(
|
|
3026
|
+
export function writeFile(
|
|
3235
3027
|
file: PathOrFileDescriptor,
|
|
3236
3028
|
data: string | NodeJS.ArrayBufferView,
|
|
3237
3029
|
options: WriteFileOptions,
|
|
@@ -3243,12 +3035,12 @@ declare module "node:fs" {
|
|
|
3243
3035
|
* If a file descriptor is provided, the underlying file will _not_ be closed automatically.
|
|
3244
3036
|
* @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
|
|
3245
3037
|
*/
|
|
3246
|
-
function writeFile(
|
|
3038
|
+
export function writeFile(
|
|
3247
3039
|
path: PathOrFileDescriptor,
|
|
3248
3040
|
data: string | NodeJS.ArrayBufferView,
|
|
3249
3041
|
callback: NoParamCallback,
|
|
3250
3042
|
): void;
|
|
3251
|
-
namespace writeFile {
|
|
3043
|
+
export namespace writeFile {
|
|
3252
3044
|
/**
|
|
3253
3045
|
* Asynchronously writes data to a file, replacing the file if it already exists.
|
|
3254
3046
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -3277,7 +3069,7 @@ declare module "node:fs" {
|
|
|
3277
3069
|
* @since v0.1.29
|
|
3278
3070
|
* @param file filename or file descriptor
|
|
3279
3071
|
*/
|
|
3280
|
-
function writeFileSync(
|
|
3072
|
+
export function writeFileSync(
|
|
3281
3073
|
file: PathOrFileDescriptor,
|
|
3282
3074
|
data: string | NodeJS.ArrayBufferView,
|
|
3283
3075
|
options?: WriteFileOptions,
|
|
@@ -3335,7 +3127,7 @@ declare module "node:fs" {
|
|
|
3335
3127
|
* @since v0.6.7
|
|
3336
3128
|
* @param path filename or file descriptor
|
|
3337
3129
|
*/
|
|
3338
|
-
function appendFile(
|
|
3130
|
+
export function appendFile(
|
|
3339
3131
|
path: PathOrFileDescriptor,
|
|
3340
3132
|
data: string | Uint8Array,
|
|
3341
3133
|
options: WriteFileOptions,
|
|
@@ -3347,8 +3139,8 @@ declare module "node:fs" {
|
|
|
3347
3139
|
* If a file descriptor is provided, the underlying file will _not_ be closed automatically.
|
|
3348
3140
|
* @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
|
|
3349
3141
|
*/
|
|
3350
|
-
function appendFile(file: PathOrFileDescriptor, data: string | Uint8Array, callback: NoParamCallback): void;
|
|
3351
|
-
namespace appendFile {
|
|
3142
|
+
export function appendFile(file: PathOrFileDescriptor, data: string | Uint8Array, callback: NoParamCallback): void;
|
|
3143
|
+
export namespace appendFile {
|
|
3352
3144
|
/**
|
|
3353
3145
|
* Asynchronously append data to a file, creating the file if it does not exist.
|
|
3354
3146
|
* @param file A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -3414,7 +3206,7 @@ declare module "node:fs" {
|
|
|
3414
3206
|
* @since v0.6.7
|
|
3415
3207
|
* @param path filename or file descriptor
|
|
3416
3208
|
*/
|
|
3417
|
-
function appendFileSync(
|
|
3209
|
+
export function appendFileSync(
|
|
3418
3210
|
path: PathOrFileDescriptor,
|
|
3419
3211
|
data: string | Uint8Array,
|
|
3420
3212
|
options?: WriteFileOptions,
|
|
@@ -3465,7 +3257,7 @@ declare module "node:fs" {
|
|
|
3465
3257
|
* * the file is renamed and then renamed a second time back to its original name
|
|
3466
3258
|
* @since v0.1.31
|
|
3467
3259
|
*/
|
|
3468
|
-
interface WatchFileOptions {
|
|
3260
|
+
export interface WatchFileOptions {
|
|
3469
3261
|
bigint?: boolean | undefined;
|
|
3470
3262
|
persistent?: boolean | undefined;
|
|
3471
3263
|
interval?: number | undefined;
|
|
@@ -3516,7 +3308,7 @@ declare module "node:fs" {
|
|
|
3516
3308
|
* * the file is renamed and then renamed a second time back to its original name
|
|
3517
3309
|
* @since v0.1.31
|
|
3518
3310
|
*/
|
|
3519
|
-
function watchFile(
|
|
3311
|
+
export function watchFile(
|
|
3520
3312
|
filename: PathLike,
|
|
3521
3313
|
options:
|
|
3522
3314
|
| (WatchFileOptions & {
|
|
@@ -3525,7 +3317,7 @@ declare module "node:fs" {
|
|
|
3525
3317
|
| undefined,
|
|
3526
3318
|
listener: StatsListener,
|
|
3527
3319
|
): StatWatcher;
|
|
3528
|
-
function watchFile(
|
|
3320
|
+
export function watchFile(
|
|
3529
3321
|
filename: PathLike,
|
|
3530
3322
|
options:
|
|
3531
3323
|
| (WatchFileOptions & {
|
|
@@ -3538,7 +3330,7 @@ declare module "node:fs" {
|
|
|
3538
3330
|
* Watch for changes on `filename`. The callback `listener` will be called each time the file is accessed.
|
|
3539
3331
|
* @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
|
|
3540
3332
|
*/
|
|
3541
|
-
function watchFile(filename: PathLike, listener: StatsListener): StatWatcher;
|
|
3333
|
+
export function watchFile(filename: PathLike, listener: StatsListener): StatWatcher;
|
|
3542
3334
|
/**
|
|
3543
3335
|
* Stop watching for changes on `filename`. If `listener` is specified, only that
|
|
3544
3336
|
* particular listener is removed. Otherwise, _all_ listeners are removed,
|
|
@@ -3551,25 +3343,23 @@ declare module "node:fs" {
|
|
|
3551
3343
|
* @since v0.1.31
|
|
3552
3344
|
* @param listener Optional, a listener previously attached using `fs.watchFile()`
|
|
3553
3345
|
*/
|
|
3554
|
-
function unwatchFile(filename: PathLike, listener?: StatsListener): void;
|
|
3555
|
-
function unwatchFile(filename: PathLike, listener?: BigIntStatsListener): void;
|
|
3556
|
-
|
|
3557
|
-
interface WatchOptions extends Abortable {
|
|
3346
|
+
export function unwatchFile(filename: PathLike, listener?: StatsListener): void;
|
|
3347
|
+
export function unwatchFile(filename: PathLike, listener?: BigIntStatsListener): void;
|
|
3348
|
+
export interface WatchOptions extends Abortable {
|
|
3558
3349
|
encoding?: BufferEncoding | "buffer" | undefined;
|
|
3559
3350
|
persistent?: boolean | undefined;
|
|
3560
3351
|
recursive?: boolean | undefined;
|
|
3561
|
-
ignore?: WatchIgnorePredicate | readonly WatchIgnorePredicate[] | undefined;
|
|
3562
3352
|
}
|
|
3563
|
-
interface WatchOptionsWithBufferEncoding extends WatchOptions {
|
|
3353
|
+
export interface WatchOptionsWithBufferEncoding extends WatchOptions {
|
|
3564
3354
|
encoding: "buffer";
|
|
3565
3355
|
}
|
|
3566
|
-
interface WatchOptionsWithStringEncoding extends WatchOptions {
|
|
3356
|
+
export interface WatchOptionsWithStringEncoding extends WatchOptions {
|
|
3567
3357
|
encoding?: BufferEncoding | undefined;
|
|
3568
3358
|
}
|
|
3569
|
-
type WatchEventType = "rename" | "change";
|
|
3570
|
-
type WatchListener<T> = (event: WatchEventType, filename: T | null) => void;
|
|
3571
|
-
type StatsListener = (curr: Stats, prev: Stats) => void;
|
|
3572
|
-
type BigIntStatsListener = (curr: BigIntStats, prev: BigIntStats) => void;
|
|
3359
|
+
export type WatchEventType = "rename" | "change";
|
|
3360
|
+
export type WatchListener<T> = (event: WatchEventType, filename: T | null) => void;
|
|
3361
|
+
export type StatsListener = (curr: Stats, prev: Stats) => void;
|
|
3362
|
+
export type BigIntStatsListener = (curr: BigIntStats, prev: BigIntStats) => void;
|
|
3573
3363
|
/**
|
|
3574
3364
|
* Watch for changes on `filename`, where `filename` is either a file or a
|
|
3575
3365
|
* directory.
|
|
@@ -3590,22 +3380,22 @@ declare module "node:fs" {
|
|
|
3590
3380
|
* @since v0.5.10
|
|
3591
3381
|
* @param listener
|
|
3592
3382
|
*/
|
|
3593
|
-
function watch(
|
|
3383
|
+
export function watch(
|
|
3594
3384
|
filename: PathLike,
|
|
3595
3385
|
options?: WatchOptionsWithStringEncoding | BufferEncoding | null,
|
|
3596
3386
|
listener?: WatchListener<string>,
|
|
3597
3387
|
): FSWatcher;
|
|
3598
|
-
function watch(
|
|
3388
|
+
export function watch(
|
|
3599
3389
|
filename: PathLike,
|
|
3600
3390
|
options: WatchOptionsWithBufferEncoding | "buffer",
|
|
3601
3391
|
listener: WatchListener<NonSharedBuffer>,
|
|
3602
3392
|
): FSWatcher;
|
|
3603
|
-
function watch(
|
|
3393
|
+
export function watch(
|
|
3604
3394
|
filename: PathLike,
|
|
3605
3395
|
options: WatchOptions | BufferEncoding | "buffer" | null,
|
|
3606
3396
|
listener: WatchListener<string | NonSharedBuffer>,
|
|
3607
3397
|
): FSWatcher;
|
|
3608
|
-
function watch(filename: PathLike, listener: WatchListener<string>): FSWatcher;
|
|
3398
|
+
export function watch(filename: PathLike, listener: WatchListener<string>): FSWatcher;
|
|
3609
3399
|
/**
|
|
3610
3400
|
* Test whether or not the given path exists by checking with the file system.
|
|
3611
3401
|
* Then call the `callback` argument with either true or false:
|
|
@@ -3735,9 +3525,9 @@ declare module "node:fs" {
|
|
|
3735
3525
|
* @since v0.0.2
|
|
3736
3526
|
* @deprecated Since v1.0.0 - Use {@link stat} or {@link access} instead.
|
|
3737
3527
|
*/
|
|
3738
|
-
function exists(path: PathLike, callback: (exists: boolean) => void): void;
|
|
3528
|
+
export function exists(path: PathLike, callback: (exists: boolean) => void): void;
|
|
3739
3529
|
/** @deprecated */
|
|
3740
|
-
namespace exists {
|
|
3530
|
+
export namespace exists {
|
|
3741
3531
|
/**
|
|
3742
3532
|
* @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
|
|
3743
3533
|
* URL support is _experimental_.
|
|
@@ -3761,8 +3551,8 @@ declare module "node:fs" {
|
|
|
3761
3551
|
* ```
|
|
3762
3552
|
* @since v0.1.21
|
|
3763
3553
|
*/
|
|
3764
|
-
function existsSync(path: PathLike): boolean;
|
|
3765
|
-
namespace constants {
|
|
3554
|
+
export function existsSync(path: PathLike): boolean;
|
|
3555
|
+
export namespace constants {
|
|
3766
3556
|
// File Access Constants
|
|
3767
3557
|
/** Constant for fs.access(). File is visible to the calling process. */
|
|
3768
3558
|
const F_OK: number;
|
|
@@ -4036,13 +3826,13 @@ declare module "node:fs" {
|
|
|
4036
3826
|
* @since v0.11.15
|
|
4037
3827
|
* @param [mode=fs.constants.F_OK]
|
|
4038
3828
|
*/
|
|
4039
|
-
function access(path: PathLike, mode: number | undefined, callback: NoParamCallback): void;
|
|
3829
|
+
export function access(path: PathLike, mode: number | undefined, callback: NoParamCallback): void;
|
|
4040
3830
|
/**
|
|
4041
3831
|
* Asynchronously tests a user's permissions for the file specified by path.
|
|
4042
3832
|
* @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
|
|
4043
3833
|
*/
|
|
4044
|
-
function access(path: PathLike, callback: NoParamCallback): void;
|
|
4045
|
-
namespace access {
|
|
3834
|
+
export function access(path: PathLike, callback: NoParamCallback): void;
|
|
3835
|
+
export namespace access {
|
|
4046
3836
|
/**
|
|
4047
3837
|
* Asynchronously tests a user's permissions for the file specified by path.
|
|
4048
3838
|
* @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -4073,11 +3863,11 @@ declare module "node:fs" {
|
|
|
4073
3863
|
* @since v0.11.15
|
|
4074
3864
|
* @param [mode=fs.constants.F_OK]
|
|
4075
3865
|
*/
|
|
4076
|
-
function accessSync(path: PathLike, mode?: number): void;
|
|
3866
|
+
export function accessSync(path: PathLike, mode?: number): void;
|
|
4077
3867
|
interface StreamOptions {
|
|
4078
3868
|
flags?: string | undefined;
|
|
4079
3869
|
encoding?: BufferEncoding | undefined;
|
|
4080
|
-
fd?: number | FileHandle | undefined;
|
|
3870
|
+
fd?: number | promises.FileHandle | undefined;
|
|
4081
3871
|
mode?: number | undefined;
|
|
4082
3872
|
autoClose?: boolean | undefined;
|
|
4083
3873
|
emitClose?: boolean | undefined;
|
|
@@ -4165,7 +3955,7 @@ declare module "node:fs" {
|
|
|
4165
3955
|
* If `options` is a string, then it specifies the encoding.
|
|
4166
3956
|
* @since v0.1.31
|
|
4167
3957
|
*/
|
|
4168
|
-
function createReadStream(path: PathLike, options?: BufferEncoding | ReadStreamOptions): ReadStream;
|
|
3958
|
+
export function createReadStream(path: PathLike, options?: BufferEncoding | ReadStreamOptions): ReadStream;
|
|
4169
3959
|
/**
|
|
4170
3960
|
* `options` may also include a `start` option to allow writing data at some
|
|
4171
3961
|
* position past the beginning of the file, allowed values are in the
|
|
@@ -4193,7 +3983,7 @@ declare module "node:fs" {
|
|
|
4193
3983
|
* If `options` is a string, then it specifies the encoding.
|
|
4194
3984
|
* @since v0.1.31
|
|
4195
3985
|
*/
|
|
4196
|
-
function createWriteStream(path: PathLike, options?: BufferEncoding | WriteStreamOptions): WriteStream;
|
|
3986
|
+
export function createWriteStream(path: PathLike, options?: BufferEncoding | WriteStreamOptions): WriteStream;
|
|
4197
3987
|
/**
|
|
4198
3988
|
* Forces all currently queued I/O operations associated with the file to the
|
|
4199
3989
|
* operating system's synchronized I/O completion state. Refer to the POSIX [`fdatasync(2)`](http://man7.org/linux/man-pages/man2/fdatasync.2.html) documentation for details. No arguments other
|
|
@@ -4201,8 +3991,8 @@ declare module "node:fs" {
|
|
|
4201
3991
|
* exception are given to the completion callback.
|
|
4202
3992
|
* @since v0.1.96
|
|
4203
3993
|
*/
|
|
4204
|
-
function fdatasync(fd: number, callback: NoParamCallback): void;
|
|
4205
|
-
namespace fdatasync {
|
|
3994
|
+
export function fdatasync(fd: number, callback: NoParamCallback): void;
|
|
3995
|
+
export namespace fdatasync {
|
|
4206
3996
|
/**
|
|
4207
3997
|
* Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device.
|
|
4208
3998
|
* @param fd A file descriptor.
|
|
@@ -4214,7 +4004,7 @@ declare module "node:fs" {
|
|
|
4214
4004
|
* operating system's synchronized I/O completion state. Refer to the POSIX [`fdatasync(2)`](http://man7.org/linux/man-pages/man2/fdatasync.2.html) documentation for details. Returns `undefined`.
|
|
4215
4005
|
* @since v0.1.96
|
|
4216
4006
|
*/
|
|
4217
|
-
function fdatasyncSync(fd: number): void;
|
|
4007
|
+
export function fdatasyncSync(fd: number): void;
|
|
4218
4008
|
/**
|
|
4219
4009
|
* Asynchronously copies `src` to `dest`. By default, `dest` is overwritten if it
|
|
4220
4010
|
* already exists. No arguments other than a possible exception are given to the
|
|
@@ -4254,9 +4044,9 @@ declare module "node:fs" {
|
|
|
4254
4044
|
* @param dest destination filename of the copy operation
|
|
4255
4045
|
* @param [mode=0] modifiers for copy operation.
|
|
4256
4046
|
*/
|
|
4257
|
-
function copyFile(src: PathLike, dest: PathLike, callback: NoParamCallback): void;
|
|
4258
|
-
function copyFile(src: PathLike, dest: PathLike, mode: number, callback: NoParamCallback): void;
|
|
4259
|
-
namespace copyFile {
|
|
4047
|
+
export function copyFile(src: PathLike, dest: PathLike, callback: NoParamCallback): void;
|
|
4048
|
+
export function copyFile(src: PathLike, dest: PathLike, mode: number, callback: NoParamCallback): void;
|
|
4049
|
+
export namespace copyFile {
|
|
4260
4050
|
function __promisify__(src: PathLike, dst: PathLike, mode?: number): Promise<void>;
|
|
4261
4051
|
}
|
|
4262
4052
|
/**
|
|
@@ -4293,7 +4083,7 @@ declare module "node:fs" {
|
|
|
4293
4083
|
* @param dest destination filename of the copy operation
|
|
4294
4084
|
* @param [mode=0] modifiers for copy operation.
|
|
4295
4085
|
*/
|
|
4296
|
-
function copyFileSync(src: PathLike, dest: PathLike, mode?: number): void;
|
|
4086
|
+
export function copyFileSync(src: PathLike, dest: PathLike, mode?: number): void;
|
|
4297
4087
|
/**
|
|
4298
4088
|
* Write an array of `ArrayBufferView`s to the file specified by `fd` using `writev()`.
|
|
4299
4089
|
*
|
|
@@ -4314,12 +4104,12 @@ declare module "node:fs" {
|
|
|
4314
4104
|
* @since v12.9.0
|
|
4315
4105
|
* @param [position='null']
|
|
4316
4106
|
*/
|
|
4317
|
-
function writev<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
|
|
4107
|
+
export function writev<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
|
|
4318
4108
|
fd: number,
|
|
4319
4109
|
buffers: TBuffers,
|
|
4320
4110
|
cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: TBuffers) => void,
|
|
4321
4111
|
): void;
|
|
4322
|
-
function writev<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
|
|
4112
|
+
export function writev<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
|
|
4323
4113
|
fd: number,
|
|
4324
4114
|
buffers: TBuffers,
|
|
4325
4115
|
position: number | null,
|
|
@@ -4327,11 +4117,11 @@ declare module "node:fs" {
|
|
|
4327
4117
|
): void;
|
|
4328
4118
|
// Providing a default type parameter doesn't provide true BC for userland consumers, but at least suppresses TS2314
|
|
4329
4119
|
// TODO: remove default in future major version
|
|
4330
|
-
interface WriteVResult<T extends readonly NodeJS.ArrayBufferView[] = NodeJS.ArrayBufferView[]> {
|
|
4120
|
+
export interface WriteVResult<T extends readonly NodeJS.ArrayBufferView[] = NodeJS.ArrayBufferView[]> {
|
|
4331
4121
|
bytesWritten: number;
|
|
4332
4122
|
buffers: T;
|
|
4333
4123
|
}
|
|
4334
|
-
namespace writev {
|
|
4124
|
+
export namespace writev {
|
|
4335
4125
|
function __promisify__<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
|
|
4336
4126
|
fd: number,
|
|
4337
4127
|
buffers: TBuffers,
|
|
@@ -4345,7 +4135,7 @@ declare module "node:fs" {
|
|
|
4345
4135
|
* @param [position='null']
|
|
4346
4136
|
* @return The number of bytes written.
|
|
4347
4137
|
*/
|
|
4348
|
-
function writevSync(fd: number, buffers: readonly NodeJS.ArrayBufferView[], position?: number): number;
|
|
4138
|
+
export function writevSync(fd: number, buffers: readonly NodeJS.ArrayBufferView[], position?: number): number;
|
|
4349
4139
|
/**
|
|
4350
4140
|
* Read from a file specified by `fd` and write to an array of `ArrayBufferView`s
|
|
4351
4141
|
* using `readv()`.
|
|
@@ -4361,12 +4151,12 @@ declare module "node:fs" {
|
|
|
4361
4151
|
* @since v13.13.0, v12.17.0
|
|
4362
4152
|
* @param [position='null']
|
|
4363
4153
|
*/
|
|
4364
|
-
function readv<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
|
|
4154
|
+
export function readv<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
|
|
4365
4155
|
fd: number,
|
|
4366
4156
|
buffers: TBuffers,
|
|
4367
4157
|
cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: TBuffers) => void,
|
|
4368
4158
|
): void;
|
|
4369
|
-
function readv<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
|
|
4159
|
+
export function readv<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
|
|
4370
4160
|
fd: number,
|
|
4371
4161
|
buffers: TBuffers,
|
|
4372
4162
|
position: number | null,
|
|
@@ -4374,11 +4164,11 @@ declare module "node:fs" {
|
|
|
4374
4164
|
): void;
|
|
4375
4165
|
// Providing a default type parameter doesn't provide true BC for userland consumers, but at least suppresses TS2314
|
|
4376
4166
|
// TODO: remove default in future major version
|
|
4377
|
-
interface ReadVResult<T extends readonly NodeJS.ArrayBufferView[] = NodeJS.ArrayBufferView[]> {
|
|
4167
|
+
export interface ReadVResult<T extends readonly NodeJS.ArrayBufferView[] = NodeJS.ArrayBufferView[]> {
|
|
4378
4168
|
bytesRead: number;
|
|
4379
4169
|
buffers: T;
|
|
4380
4170
|
}
|
|
4381
|
-
namespace readv {
|
|
4171
|
+
export namespace readv {
|
|
4382
4172
|
function __promisify__<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
|
|
4383
4173
|
fd: number,
|
|
4384
4174
|
buffers: TBuffers,
|
|
@@ -4392,9 +4182,9 @@ declare module "node:fs" {
|
|
|
4392
4182
|
* @param [position='null']
|
|
4393
4183
|
* @return The number of bytes read.
|
|
4394
4184
|
*/
|
|
4395
|
-
function readvSync(fd: number, buffers: readonly NodeJS.ArrayBufferView[], position?: number): number;
|
|
4185
|
+
export function readvSync(fd: number, buffers: readonly NodeJS.ArrayBufferView[], position?: number): number;
|
|
4396
4186
|
|
|
4397
|
-
interface OpenAsBlobOptions {
|
|
4187
|
+
export interface OpenAsBlobOptions {
|
|
4398
4188
|
/**
|
|
4399
4189
|
* An optional mime type for the blob.
|
|
4400
4190
|
*
|
|
@@ -4420,9 +4210,9 @@ declare module "node:fs" {
|
|
|
4420
4210
|
* ```
|
|
4421
4211
|
* @since v19.8.0
|
|
4422
4212
|
*/
|
|
4423
|
-
function openAsBlob(path: PathLike, options?: OpenAsBlobOptions): Promise<Blob>;
|
|
4213
|
+
export function openAsBlob(path: PathLike, options?: OpenAsBlobOptions): Promise<Blob>;
|
|
4424
4214
|
|
|
4425
|
-
interface OpenDirOptions {
|
|
4215
|
+
export interface OpenDirOptions {
|
|
4426
4216
|
/**
|
|
4427
4217
|
* @default 'utf8'
|
|
4428
4218
|
*/
|
|
@@ -4449,7 +4239,7 @@ declare module "node:fs" {
|
|
|
4449
4239
|
* directory and subsequent read operations.
|
|
4450
4240
|
* @since v12.12.0
|
|
4451
4241
|
*/
|
|
4452
|
-
function opendirSync(path: PathLike, options?: OpenDirOptions): Dir;
|
|
4242
|
+
export function opendirSync(path: PathLike, options?: OpenDirOptions): Dir;
|
|
4453
4243
|
/**
|
|
4454
4244
|
* Asynchronously open a directory. See the POSIX [`opendir(3)`](http://man7.org/linux/man-pages/man3/opendir.3.html) documentation for
|
|
4455
4245
|
* more details.
|
|
@@ -4461,28 +4251,28 @@ declare module "node:fs" {
|
|
|
4461
4251
|
* directory and subsequent read operations.
|
|
4462
4252
|
* @since v12.12.0
|
|
4463
4253
|
*/
|
|
4464
|
-
function opendir(path: PathLike, cb: (err: NodeJS.ErrnoException | null, dir: Dir) => void): void;
|
|
4465
|
-
function opendir(
|
|
4254
|
+
export function opendir(path: PathLike, cb: (err: NodeJS.ErrnoException | null, dir: Dir) => void): void;
|
|
4255
|
+
export function opendir(
|
|
4466
4256
|
path: PathLike,
|
|
4467
4257
|
options: OpenDirOptions,
|
|
4468
4258
|
cb: (err: NodeJS.ErrnoException | null, dir: Dir) => void,
|
|
4469
4259
|
): void;
|
|
4470
|
-
namespace opendir {
|
|
4260
|
+
export namespace opendir {
|
|
4471
4261
|
function __promisify__(path: PathLike, options?: OpenDirOptions): Promise<Dir>;
|
|
4472
4262
|
}
|
|
4473
|
-
interface BigIntStats extends StatsBase<bigint> {
|
|
4263
|
+
export interface BigIntStats extends StatsBase<bigint> {
|
|
4474
4264
|
atimeNs: bigint;
|
|
4475
4265
|
mtimeNs: bigint;
|
|
4476
4266
|
ctimeNs: bigint;
|
|
4477
4267
|
birthtimeNs: bigint;
|
|
4478
4268
|
}
|
|
4479
|
-
interface BigIntOptions {
|
|
4269
|
+
export interface BigIntOptions {
|
|
4480
4270
|
bigint: true;
|
|
4481
4271
|
}
|
|
4482
|
-
interface StatOptions {
|
|
4272
|
+
export interface StatOptions {
|
|
4483
4273
|
bigint?: boolean | undefined;
|
|
4484
4274
|
}
|
|
4485
|
-
interface StatSyncOptions extends StatOptions {
|
|
4275
|
+
export interface StatSyncOptions extends StatOptions {
|
|
4486
4276
|
throwIfNoEntry?: boolean | undefined;
|
|
4487
4277
|
}
|
|
4488
4278
|
interface CopyOptionsBase {
|
|
@@ -4525,14 +4315,14 @@ declare module "node:fs" {
|
|
|
4525
4315
|
*/
|
|
4526
4316
|
verbatimSymlinks?: boolean | undefined;
|
|
4527
4317
|
}
|
|
4528
|
-
interface CopyOptions extends CopyOptionsBase {
|
|
4318
|
+
export interface CopyOptions extends CopyOptionsBase {
|
|
4529
4319
|
/**
|
|
4530
4320
|
* Function to filter copied files/directories. Return
|
|
4531
4321
|
* `true` to copy the item, `false` to ignore it.
|
|
4532
4322
|
*/
|
|
4533
4323
|
filter?: ((source: string, destination: string) => boolean | Promise<boolean>) | undefined;
|
|
4534
4324
|
}
|
|
4535
|
-
interface CopySyncOptions extends CopyOptionsBase {
|
|
4325
|
+
export interface CopySyncOptions extends CopyOptionsBase {
|
|
4536
4326
|
/**
|
|
4537
4327
|
* Function to filter copied files/directories. Return
|
|
4538
4328
|
* `true` to copy the item, `false` to ignore it.
|
|
@@ -4550,12 +4340,12 @@ declare module "node:fs" {
|
|
|
4550
4340
|
* @param src source path to copy.
|
|
4551
4341
|
* @param dest destination path to copy to.
|
|
4552
4342
|
*/
|
|
4553
|
-
function cp(
|
|
4343
|
+
export function cp(
|
|
4554
4344
|
source: string | URL,
|
|
4555
4345
|
destination: string | URL,
|
|
4556
4346
|
callback: (err: NodeJS.ErrnoException | null) => void,
|
|
4557
4347
|
): void;
|
|
4558
|
-
function cp(
|
|
4348
|
+
export function cp(
|
|
4559
4349
|
source: string | URL,
|
|
4560
4350
|
destination: string | URL,
|
|
4561
4351
|
opts: CopyOptions,
|
|
@@ -4572,9 +4362,8 @@ declare module "node:fs" {
|
|
|
4572
4362
|
* @param src source path to copy.
|
|
4573
4363
|
* @param dest destination path to copy to.
|
|
4574
4364
|
*/
|
|
4575
|
-
function cpSync(source: string | URL, destination: string | URL, opts?: CopySyncOptions): void;
|
|
4365
|
+
export function cpSync(source: string | URL, destination: string | URL, opts?: CopySyncOptions): void;
|
|
4576
4366
|
|
|
4577
|
-
// TODO: collapse
|
|
4578
4367
|
interface _GlobOptions<T extends Dirent | string> {
|
|
4579
4368
|
/**
|
|
4580
4369
|
* Current working directory.
|
|
@@ -4591,18 +4380,15 @@ declare module "node:fs" {
|
|
|
4591
4380
|
* Function to filter out files/directories or a
|
|
4592
4381
|
* list of glob patterns to be excluded. If a function is provided, return
|
|
4593
4382
|
* `true` to exclude the item, `false` to include it.
|
|
4594
|
-
* If a string array is provided, each string should be a glob pattern that
|
|
4595
|
-
* specifies paths to exclude. Note: Negation patterns (e.g., '!foo.js') are
|
|
4596
|
-
* not supported.
|
|
4597
4383
|
* @default undefined
|
|
4598
4384
|
*/
|
|
4599
4385
|
exclude?: ((fileName: T) => boolean) | readonly string[] | undefined;
|
|
4600
4386
|
}
|
|
4601
|
-
interface GlobOptions extends _GlobOptions<Dirent | string> {}
|
|
4602
|
-
interface GlobOptionsWithFileTypes extends _GlobOptions<Dirent> {
|
|
4387
|
+
export interface GlobOptions extends _GlobOptions<Dirent | string> {}
|
|
4388
|
+
export interface GlobOptionsWithFileTypes extends _GlobOptions<Dirent> {
|
|
4603
4389
|
withFileTypes: true;
|
|
4604
4390
|
}
|
|
4605
|
-
interface GlobOptionsWithoutFileTypes extends _GlobOptions<string> {
|
|
4391
|
+
export interface GlobOptionsWithoutFileTypes extends _GlobOptions<string> {
|
|
4606
4392
|
withFileTypes?: false | undefined;
|
|
4607
4393
|
}
|
|
4608
4394
|
|
|
@@ -4619,11 +4405,11 @@ declare module "node:fs" {
|
|
|
4619
4405
|
* ```
|
|
4620
4406
|
* @since v22.0.0
|
|
4621
4407
|
*/
|
|
4622
|
-
function glob(
|
|
4408
|
+
export function glob(
|
|
4623
4409
|
pattern: string | readonly string[],
|
|
4624
4410
|
callback: (err: NodeJS.ErrnoException | null, matches: string[]) => void,
|
|
4625
4411
|
): void;
|
|
4626
|
-
function glob(
|
|
4412
|
+
export function glob(
|
|
4627
4413
|
pattern: string | readonly string[],
|
|
4628
4414
|
options: GlobOptionsWithFileTypes,
|
|
4629
4415
|
callback: (
|
|
@@ -4631,7 +4417,7 @@ declare module "node:fs" {
|
|
|
4631
4417
|
matches: Dirent[],
|
|
4632
4418
|
) => void,
|
|
4633
4419
|
): void;
|
|
4634
|
-
function glob(
|
|
4420
|
+
export function glob(
|
|
4635
4421
|
pattern: string | readonly string[],
|
|
4636
4422
|
options: GlobOptionsWithoutFileTypes,
|
|
4637
4423
|
callback: (
|
|
@@ -4639,7 +4425,7 @@ declare module "node:fs" {
|
|
|
4639
4425
|
matches: string[],
|
|
4640
4426
|
) => void,
|
|
4641
4427
|
): void;
|
|
4642
|
-
function glob(
|
|
4428
|
+
export function glob(
|
|
4643
4429
|
pattern: string | readonly string[],
|
|
4644
4430
|
options: GlobOptions,
|
|
4645
4431
|
callback: (
|
|
@@ -4656,23 +4442,20 @@ declare module "node:fs" {
|
|
|
4656
4442
|
* @since v22.0.0
|
|
4657
4443
|
* @returns paths of files that match the pattern.
|
|
4658
4444
|
*/
|
|
4659
|
-
function globSync(pattern: string | readonly string[]): string[];
|
|
4660
|
-
function globSync(
|
|
4445
|
+
export function globSync(pattern: string | readonly string[]): string[];
|
|
4446
|
+
export function globSync(
|
|
4661
4447
|
pattern: string | readonly string[],
|
|
4662
4448
|
options: GlobOptionsWithFileTypes,
|
|
4663
4449
|
): Dirent[];
|
|
4664
|
-
function globSync(
|
|
4450
|
+
export function globSync(
|
|
4665
4451
|
pattern: string | readonly string[],
|
|
4666
4452
|
options: GlobOptionsWithoutFileTypes,
|
|
4667
4453
|
): string[];
|
|
4668
|
-
function globSync(
|
|
4454
|
+
export function globSync(
|
|
4669
4455
|
pattern: string | readonly string[],
|
|
4670
4456
|
options: GlobOptions,
|
|
4671
4457
|
): Dirent[] | string[];
|
|
4672
4458
|
}
|
|
4673
4459
|
declare module "node:fs" {
|
|
4674
|
-
export *
|
|
4675
|
-
}
|
|
4676
|
-
declare module "fs" {
|
|
4677
|
-
export * from "node:fs";
|
|
4460
|
+
export * from "fs";
|
|
4678
4461
|
}
|