cdk-common 2.0.221 → 2.0.224
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.jsii +3 -3
- package/lib/main.js +1 -1
- package/node_modules/@aws-cdk/assert/package.json +8 -8
- package/node_modules/@aws-cdk/cfnspec/package.json +3 -3
- package/node_modules/@aws-cdk/cfnspec/tsconfig.tsbuildinfo +5 -5
- package/node_modules/@aws-cdk/cloudformation-diff/package.json +5 -5
- package/node_modules/{@aws-cdk/cloudformation-diff/node_modules/@types → @types}/node/LICENSE +0 -0
- package/node_modules/@types/node/README.md +16 -0
- package/node_modules/{@aws-cdk/cloudformation-diff/node_modules/@types → @types}/node/assert.d.ts +35 -6
- package/node_modules/{@aws-cdk/cloudformation-diff/node_modules/@types → @types}/node/async_hooks.d.ts +96 -11
- package/node_modules/@types/node/buffer.d.ts +89 -0
- package/node_modules/@types/node/child_process.d.ts +514 -0
- package/node_modules/{@aws-cdk/cloudformation-diff/node_modules/@types → @types}/node/cluster.d.ts +43 -38
- package/node_modules/@types/node/console.d.ts +142 -0
- package/node_modules/@types/node/constants.d.ts +18 -0
- package/node_modules/@types/node/crypto.d.ts +1283 -0
- package/node_modules/@types/node/dgram.d.ts +144 -0
- package/node_modules/{@aws-cdk/cloudformation-diff/node_modules/@types → @types}/node/dns.d.ts +33 -12
- package/node_modules/@types/node/domain.d.ts +27 -0
- package/node_modules/@types/node/events.d.ts +82 -0
- package/node_modules/@types/node/fs/promises.d.ts +569 -0
- package/node_modules/{@aws-cdk/cloudformation-diff/node_modules/@types → @types}/node/fs.d.ts +736 -757
- package/node_modules/@types/node/globals.d.ts +746 -0
- package/node_modules/@types/node/globals.global.d.ts +1 -0
- package/node_modules/@types/node/http.d.ts +492 -0
- package/node_modules/{@aws-cdk/cloudformation-diff/node_modules/@types → @types}/node/http2.d.ts +289 -186
- package/node_modules/@types/node/https.d.ts +142 -0
- package/node_modules/@types/node/index.d.ts +98 -0
- package/node_modules/{@aws-cdk/cloudformation-diff/node_modules/@types → @types}/node/inspector.d.ts +1508 -1619
- package/node_modules/@types/node/module.d.ts +56 -0
- package/node_modules/{@aws-cdk/cloudformation-diff/node_modules/@types → @types}/node/net.d.ts +128 -71
- package/node_modules/@types/node/os.d.ts +242 -0
- package/node_modules/{@aws-cdk/cloudformation-diff/node_modules/@types → @types}/node/package.json +67 -23
- package/node_modules/@types/node/path.d.ts +168 -0
- package/node_modules/{@aws-cdk/cloudformation-diff/node_modules/@types → @types}/node/perf_hooks.d.ts +124 -19
- package/node_modules/@types/node/process.d.ts +413 -0
- package/node_modules/{@aws-cdk/cloudformation-diff/node_modules/@types → @types}/node/punycode.d.ts +11 -1
- package/node_modules/@types/node/querystring.d.ts +31 -0
- package/node_modules/{@aws-cdk/cloudformation-diff/node_modules/@types → @types}/node/readline.d.ts +55 -24
- package/node_modules/{@aws-cdk/cloudformation-diff/node_modules/@types → @types}/node/repl.d.ts +40 -22
- package/node_modules/{@aws-cdk/cloudformation-diff/node_modules/@types → @types}/node/stream.d.ts +103 -57
- package/node_modules/@types/node/string_decoder.d.ts +10 -0
- package/node_modules/@types/node/timers.d.ts +19 -0
- package/node_modules/@types/node/tls.d.ts +784 -0
- package/node_modules/{@aws-cdk/cloudformation-diff/node_modules/@types → @types}/node/trace_events.d.ts +7 -4
- package/node_modules/@types/node/tty.d.ts +69 -0
- package/node_modules/@types/node/url.d.ts +149 -0
- package/node_modules/{@aws-cdk/cloudformation-diff/node_modules/@types → @types}/node/util.d.ts +70 -41
- package/node_modules/@types/node/v8.d.ts +190 -0
- package/node_modules/@types/node/vm.d.ts +155 -0
- package/node_modules/@types/node/wasi.d.ts +89 -0
- package/node_modules/@types/node/worker_threads.d.ts +241 -0
- package/node_modules/{@aws-cdk/cloudformation-diff/node_modules/@types → @types}/node/zlib.d.ts +91 -54
- package/package.json +3 -3
- package/node_modules/@aws-cdk/cloudformation-diff/node_modules/@types/node/README.md +0 -16
- package/node_modules/@aws-cdk/cloudformation-diff/node_modules/@types/node/base.d.ts +0 -19
- package/node_modules/@aws-cdk/cloudformation-diff/node_modules/@types/node/buffer.d.ts +0 -16
- package/node_modules/@aws-cdk/cloudformation-diff/node_modules/@types/node/child_process.d.ts +0 -369
- package/node_modules/@aws-cdk/cloudformation-diff/node_modules/@types/node/console.d.ts +0 -3
- package/node_modules/@aws-cdk/cloudformation-diff/node_modules/@types/node/constants.d.ts +0 -449
- package/node_modules/@aws-cdk/cloudformation-diff/node_modules/@types/node/crypto.d.ts +0 -613
- package/node_modules/@aws-cdk/cloudformation-diff/node_modules/@types/node/dgram.d.ts +0 -97
- package/node_modules/@aws-cdk/cloudformation-diff/node_modules/@types/node/domain.d.ts +0 -16
- package/node_modules/@aws-cdk/cloudformation-diff/node_modules/@types/node/events.d.ts +0 -30
- package/node_modules/@aws-cdk/cloudformation-diff/node_modules/@types/node/globals.d.ts +0 -1066
- package/node_modules/@aws-cdk/cloudformation-diff/node_modules/@types/node/http.d.ts +0 -274
- package/node_modules/@aws-cdk/cloudformation-diff/node_modules/@types/node/https.d.ts +0 -51
- package/node_modules/@aws-cdk/cloudformation-diff/node_modules/@types/node/index.d.ts +0 -41
- package/node_modules/@aws-cdk/cloudformation-diff/node_modules/@types/node/module.d.ts +0 -3
- package/node_modules/@aws-cdk/cloudformation-diff/node_modules/@types/node/os.d.ts +0 -254
- package/node_modules/@aws-cdk/cloudformation-diff/node_modules/@types/node/path.d.ts +0 -159
- package/node_modules/@aws-cdk/cloudformation-diff/node_modules/@types/node/process.d.ts +0 -3
- package/node_modules/@aws-cdk/cloudformation-diff/node_modules/@types/node/querystring.d.ts +0 -17
- package/node_modules/@aws-cdk/cloudformation-diff/node_modules/@types/node/string_decoder.d.ts +0 -9
- package/node_modules/@aws-cdk/cloudformation-diff/node_modules/@types/node/timers.d.ts +0 -16
- package/node_modules/@aws-cdk/cloudformation-diff/node_modules/@types/node/tls.d.ts +0 -459
- package/node_modules/@aws-cdk/cloudformation-diff/node_modules/@types/node/ts3.6/assert.d.ts +0 -73
- package/node_modules/@aws-cdk/cloudformation-diff/node_modules/@types/node/ts3.6/base.d.ts +0 -54
- package/node_modules/@aws-cdk/cloudformation-diff/node_modules/@types/node/ts3.6/index.d.ts +0 -6
- package/node_modules/@aws-cdk/cloudformation-diff/node_modules/@types/node/tty.d.ts +0 -17
- package/node_modules/@aws-cdk/cloudformation-diff/node_modules/@types/node/url.d.ts +0 -104
- package/node_modules/@aws-cdk/cloudformation-diff/node_modules/@types/node/v8.d.ts +0 -28
- package/node_modules/@aws-cdk/cloudformation-diff/node_modules/@types/node/vm.d.ts +0 -81
- package/node_modules/@aws-cdk/cloudformation-diff/node_modules/@types/node/worker_threads.d.ts +0 -124
package/node_modules/{@aws-cdk/cloudformation-diff/node_modules/@types → @types}/node/fs.d.ts
RENAMED
|
@@ -1,15 +1,28 @@
|
|
|
1
|
-
declare module
|
|
2
|
-
import * as stream from
|
|
3
|
-
import
|
|
4
|
-
import { URL } from
|
|
1
|
+
declare module 'fs' {
|
|
2
|
+
import * as stream from 'stream';
|
|
3
|
+
import EventEmitter = require('events');
|
|
4
|
+
import { URL } from 'url';
|
|
5
|
+
import * as promises from 'fs/promises';
|
|
5
6
|
|
|
7
|
+
export { promises };
|
|
6
8
|
/**
|
|
7
9
|
* Valid types for path values in "fs".
|
|
8
10
|
*/
|
|
9
|
-
type PathLike = string | Buffer | URL;
|
|
11
|
+
export type PathLike = string | Buffer | URL;
|
|
10
12
|
|
|
11
|
-
type
|
|
12
|
-
|
|
13
|
+
export type NoParamCallback = (err: NodeJS.ErrnoException | null) => void;
|
|
14
|
+
|
|
15
|
+
export type BufferEncodingOption = 'buffer' | { encoding: 'buffer' };
|
|
16
|
+
|
|
17
|
+
export interface BaseEncodingOptions {
|
|
18
|
+
encoding?: BufferEncoding | null | undefined;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type OpenMode = number | string;
|
|
22
|
+
|
|
23
|
+
export type Mode = number | string;
|
|
24
|
+
|
|
25
|
+
export interface StatsBase<T> {
|
|
13
26
|
isFile(): boolean;
|
|
14
27
|
isDirectory(): boolean;
|
|
15
28
|
isBlockDevice(): boolean;
|
|
@@ -17,27 +30,34 @@ declare module "fs" {
|
|
|
17
30
|
isSymbolicLink(): boolean;
|
|
18
31
|
isFIFO(): boolean;
|
|
19
32
|
isSocket(): boolean;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
|
|
34
|
+
dev: T;
|
|
35
|
+
ino: T;
|
|
36
|
+
mode: T;
|
|
37
|
+
nlink: T;
|
|
38
|
+
uid: T;
|
|
39
|
+
gid: T;
|
|
40
|
+
rdev: T;
|
|
41
|
+
size: T;
|
|
42
|
+
blksize: T;
|
|
43
|
+
blocks: T;
|
|
44
|
+
atimeMs: T;
|
|
45
|
+
mtimeMs: T;
|
|
46
|
+
ctimeMs: T;
|
|
47
|
+
birthtimeMs: T;
|
|
34
48
|
atime: Date;
|
|
35
49
|
mtime: Date;
|
|
36
50
|
ctime: Date;
|
|
37
51
|
birthtime: Date;
|
|
38
52
|
}
|
|
39
53
|
|
|
40
|
-
|
|
54
|
+
export interface Stats extends StatsBase<number> {
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export class Stats {
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export class Dirent {
|
|
41
61
|
isFile(): boolean;
|
|
42
62
|
isDirectory(): boolean;
|
|
43
63
|
isBlockDevice(): boolean;
|
|
@@ -48,7 +68,47 @@ declare module "fs" {
|
|
|
48
68
|
name: string;
|
|
49
69
|
}
|
|
50
70
|
|
|
51
|
-
|
|
71
|
+
/**
|
|
72
|
+
* A class representing a directory stream.
|
|
73
|
+
*/
|
|
74
|
+
export class Dir {
|
|
75
|
+
readonly path: string;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Asynchronously iterates over the directory via `readdir(3)` until all entries have been read.
|
|
79
|
+
*/
|
|
80
|
+
[Symbol.asyncIterator](): AsyncIterableIterator<Dirent>;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Asynchronously close the directory's underlying resource handle.
|
|
84
|
+
* Subsequent reads will result in errors.
|
|
85
|
+
*/
|
|
86
|
+
close(): Promise<void>;
|
|
87
|
+
close(cb: NoParamCallback): void;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Synchronously close the directory's underlying resource handle.
|
|
91
|
+
* Subsequent reads will result in errors.
|
|
92
|
+
*/
|
|
93
|
+
closeSync(): void;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Asynchronously read the next directory entry via `readdir(3)` as an `Dirent`.
|
|
97
|
+
* After the read is completed, a value is returned that will be resolved with an `Dirent`, or `null` if there are no more directory entries to read.
|
|
98
|
+
* Directory entries returned by this function are in no particular order as provided by the operating system's underlying directory mechanisms.
|
|
99
|
+
*/
|
|
100
|
+
read(): Promise<Dirent | null>;
|
|
101
|
+
read(cb: (err: NodeJS.ErrnoException | null, dirEnt: Dirent | null) => void): void;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Synchronously read the next directory entry via `readdir(3)` as a `Dirent`.
|
|
105
|
+
* If there are no more directory entries to read, null will be returned.
|
|
106
|
+
* Directory entries returned by this function are in no particular order as provided by the operating system's underlying directory mechanisms.
|
|
107
|
+
*/
|
|
108
|
+
readSync(): Dirent | null;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export interface FSWatcher extends EventEmitter {
|
|
52
112
|
close(): void;
|
|
53
113
|
|
|
54
114
|
/**
|
|
@@ -82,66 +142,135 @@ declare module "fs" {
|
|
|
82
142
|
prependOnceListener(event: "close", listener: () => void): this;
|
|
83
143
|
}
|
|
84
144
|
|
|
85
|
-
class ReadStream extends stream.Readable {
|
|
86
|
-
close(): void;
|
|
145
|
+
export class ReadStream extends stream.Readable {
|
|
146
|
+
close(callback?: (err?: NodeJS.ErrnoException | null) => void): void;
|
|
87
147
|
bytesRead: number;
|
|
88
148
|
path: string | Buffer;
|
|
149
|
+
pending: boolean;
|
|
89
150
|
|
|
90
151
|
/**
|
|
91
152
|
* events.EventEmitter
|
|
92
153
|
* 1. open
|
|
93
154
|
* 2. close
|
|
155
|
+
* 3. ready
|
|
94
156
|
*/
|
|
95
|
-
addListener(event: string, listener: (...args: any[]) => void): this;
|
|
96
|
-
addListener(event: "open", listener: (fd: number) => void): this;
|
|
97
157
|
addListener(event: "close", listener: () => void): this;
|
|
158
|
+
addListener(event: "data", listener: (chunk: Buffer | string) => void): this;
|
|
159
|
+
addListener(event: "end", listener: () => void): this;
|
|
160
|
+
addListener(event: "error", listener: (err: Error) => void): this;
|
|
161
|
+
addListener(event: "open", listener: (fd: number) => void): this;
|
|
162
|
+
addListener(event: "pause", listener: () => void): this;
|
|
163
|
+
addListener(event: "readable", listener: () => void): this;
|
|
164
|
+
addListener(event: "ready", listener: () => void): this;
|
|
165
|
+
addListener(event: "resume", listener: () => void): this;
|
|
166
|
+
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
98
167
|
|
|
99
|
-
on(event: string, listener: (...args: any[]) => void): this;
|
|
100
|
-
on(event: "open", listener: (fd: number) => void): this;
|
|
101
168
|
on(event: "close", listener: () => void): this;
|
|
169
|
+
on(event: "data", listener: (chunk: Buffer | string) => void): this;
|
|
170
|
+
on(event: "end", listener: () => void): this;
|
|
171
|
+
on(event: "error", listener: (err: Error) => void): this;
|
|
172
|
+
on(event: "open", listener: (fd: number) => void): this;
|
|
173
|
+
on(event: "pause", listener: () => void): this;
|
|
174
|
+
on(event: "readable", listener: () => void): this;
|
|
175
|
+
on(event: "ready", listener: () => void): this;
|
|
176
|
+
on(event: "resume", listener: () => void): this;
|
|
177
|
+
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
102
178
|
|
|
103
|
-
once(event: string, listener: (...args: any[]) => void): this;
|
|
104
|
-
once(event: "open", listener: (fd: number) => void): this;
|
|
105
179
|
once(event: "close", listener: () => void): this;
|
|
180
|
+
once(event: "data", listener: (chunk: Buffer | string) => void): this;
|
|
181
|
+
once(event: "end", listener: () => void): this;
|
|
182
|
+
once(event: "error", listener: (err: Error) => void): this;
|
|
183
|
+
once(event: "open", listener: (fd: number) => void): this;
|
|
184
|
+
once(event: "pause", listener: () => void): this;
|
|
185
|
+
once(event: "readable", listener: () => void): this;
|
|
186
|
+
once(event: "ready", listener: () => void): this;
|
|
187
|
+
once(event: "resume", listener: () => void): this;
|
|
188
|
+
once(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
106
189
|
|
|
107
|
-
prependListener(event: string, listener: (...args: any[]) => void): this;
|
|
108
|
-
prependListener(event: "open", listener: (fd: number) => void): this;
|
|
109
190
|
prependListener(event: "close", listener: () => void): this;
|
|
191
|
+
prependListener(event: "data", listener: (chunk: Buffer | string) => void): this;
|
|
192
|
+
prependListener(event: "end", listener: () => void): this;
|
|
193
|
+
prependListener(event: "error", listener: (err: Error) => void): this;
|
|
194
|
+
prependListener(event: "open", listener: (fd: number) => void): this;
|
|
195
|
+
prependListener(event: "pause", listener: () => void): this;
|
|
196
|
+
prependListener(event: "readable", listener: () => void): this;
|
|
197
|
+
prependListener(event: "ready", listener: () => void): this;
|
|
198
|
+
prependListener(event: "resume", listener: () => void): this;
|
|
199
|
+
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
110
200
|
|
|
111
|
-
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
|
112
|
-
prependOnceListener(event: "open", listener: (fd: number) => void): this;
|
|
113
201
|
prependOnceListener(event: "close", listener: () => void): this;
|
|
202
|
+
prependOnceListener(event: "data", listener: (chunk: Buffer | string) => void): this;
|
|
203
|
+
prependOnceListener(event: "end", listener: () => void): this;
|
|
204
|
+
prependOnceListener(event: "error", listener: (err: Error) => void): this;
|
|
205
|
+
prependOnceListener(event: "open", listener: (fd: number) => void): this;
|
|
206
|
+
prependOnceListener(event: "pause", listener: () => void): this;
|
|
207
|
+
prependOnceListener(event: "readable", listener: () => void): this;
|
|
208
|
+
prependOnceListener(event: "ready", listener: () => void): this;
|
|
209
|
+
prependOnceListener(event: "resume", listener: () => void): this;
|
|
210
|
+
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
114
211
|
}
|
|
115
212
|
|
|
116
|
-
class WriteStream extends stream.Writable {
|
|
117
|
-
close(): void;
|
|
213
|
+
export class WriteStream extends stream.Writable {
|
|
214
|
+
close(callback?: (err?: NodeJS.ErrnoException | null) => void): void;
|
|
118
215
|
bytesWritten: number;
|
|
119
216
|
path: string | Buffer;
|
|
217
|
+
pending: boolean;
|
|
120
218
|
|
|
121
219
|
/**
|
|
122
220
|
* events.EventEmitter
|
|
123
221
|
* 1. open
|
|
124
222
|
* 2. close
|
|
223
|
+
* 3. ready
|
|
125
224
|
*/
|
|
126
|
-
addListener(event: string, listener: (...args: any[]) => void): this;
|
|
127
|
-
addListener(event: "open", listener: (fd: number) => void): this;
|
|
128
225
|
addListener(event: "close", listener: () => void): this;
|
|
226
|
+
addListener(event: "drain", listener: () => void): this;
|
|
227
|
+
addListener(event: "error", listener: (err: Error) => void): this;
|
|
228
|
+
addListener(event: "finish", listener: () => void): this;
|
|
229
|
+
addListener(event: "open", listener: (fd: number) => void): this;
|
|
230
|
+
addListener(event: "pipe", listener: (src: stream.Readable) => void): this;
|
|
231
|
+
addListener(event: "ready", listener: () => void): this;
|
|
232
|
+
addListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
|
|
233
|
+
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
129
234
|
|
|
130
|
-
on(event: string, listener: (...args: any[]) => void): this;
|
|
131
|
-
on(event: "open", listener: (fd: number) => void): this;
|
|
132
235
|
on(event: "close", listener: () => void): this;
|
|
236
|
+
on(event: "drain", listener: () => void): this;
|
|
237
|
+
on(event: "error", listener: (err: Error) => void): this;
|
|
238
|
+
on(event: "finish", listener: () => void): this;
|
|
239
|
+
on(event: "open", listener: (fd: number) => void): this;
|
|
240
|
+
on(event: "pipe", listener: (src: stream.Readable) => void): this;
|
|
241
|
+
on(event: "ready", listener: () => void): this;
|
|
242
|
+
on(event: "unpipe", listener: (src: stream.Readable) => void): this;
|
|
243
|
+
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
133
244
|
|
|
134
|
-
once(event: string, listener: (...args: any[]) => void): this;
|
|
135
|
-
once(event: "open", listener: (fd: number) => void): this;
|
|
136
245
|
once(event: "close", listener: () => void): this;
|
|
246
|
+
once(event: "drain", listener: () => void): this;
|
|
247
|
+
once(event: "error", listener: (err: Error) => void): this;
|
|
248
|
+
once(event: "finish", listener: () => void): this;
|
|
249
|
+
once(event: "open", listener: (fd: number) => void): this;
|
|
250
|
+
once(event: "pipe", listener: (src: stream.Readable) => void): this;
|
|
251
|
+
once(event: "ready", listener: () => void): this;
|
|
252
|
+
once(event: "unpipe", listener: (src: stream.Readable) => void): this;
|
|
253
|
+
once(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
137
254
|
|
|
138
|
-
prependListener(event: string, listener: (...args: any[]) => void): this;
|
|
139
|
-
prependListener(event: "open", listener: (fd: number) => void): this;
|
|
140
255
|
prependListener(event: "close", listener: () => void): this;
|
|
256
|
+
prependListener(event: "drain", listener: () => void): this;
|
|
257
|
+
prependListener(event: "error", listener: (err: Error) => void): this;
|
|
258
|
+
prependListener(event: "finish", listener: () => void): this;
|
|
259
|
+
prependListener(event: "open", listener: (fd: number) => void): this;
|
|
260
|
+
prependListener(event: "pipe", listener: (src: stream.Readable) => void): this;
|
|
261
|
+
prependListener(event: "ready", listener: () => void): this;
|
|
262
|
+
prependListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
|
|
263
|
+
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
141
264
|
|
|
142
|
-
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
|
143
|
-
prependOnceListener(event: "open", listener: (fd: number) => void): this;
|
|
144
265
|
prependOnceListener(event: "close", listener: () => void): this;
|
|
266
|
+
prependOnceListener(event: "drain", listener: () => void): this;
|
|
267
|
+
prependOnceListener(event: "error", listener: (err: Error) => void): this;
|
|
268
|
+
prependOnceListener(event: "finish", listener: () => void): this;
|
|
269
|
+
prependOnceListener(event: "open", listener: (fd: number) => void): this;
|
|
270
|
+
prependOnceListener(event: "pipe", listener: (src: stream.Readable) => void): this;
|
|
271
|
+
prependOnceListener(event: "ready", listener: () => void): this;
|
|
272
|
+
prependOnceListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
|
|
273
|
+
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
145
274
|
}
|
|
146
275
|
|
|
147
276
|
/**
|
|
@@ -151,10 +280,10 @@ declare module "fs" {
|
|
|
151
280
|
* @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
152
281
|
* URL support is _experimental_.
|
|
153
282
|
*/
|
|
154
|
-
function rename(oldPath: PathLike, newPath: PathLike, callback:
|
|
283
|
+
export function rename(oldPath: PathLike, newPath: PathLike, callback: NoParamCallback): void;
|
|
155
284
|
|
|
156
285
|
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
157
|
-
namespace rename {
|
|
286
|
+
export namespace rename {
|
|
158
287
|
/**
|
|
159
288
|
* Asynchronous rename(2) - Change the name or location of a file or directory.
|
|
160
289
|
* @param oldPath A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -172,24 +301,24 @@ declare module "fs" {
|
|
|
172
301
|
* @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
173
302
|
* URL support is _experimental_.
|
|
174
303
|
*/
|
|
175
|
-
function renameSync(oldPath: PathLike, newPath: PathLike): void;
|
|
304
|
+
export function renameSync(oldPath: PathLike, newPath: PathLike): void;
|
|
176
305
|
|
|
177
306
|
/**
|
|
178
307
|
* Asynchronous truncate(2) - Truncate a file to a specified length.
|
|
179
308
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
180
309
|
* @param len If not specified, defaults to `0`.
|
|
181
310
|
*/
|
|
182
|
-
function truncate(path: PathLike, len: number | undefined | null, callback:
|
|
311
|
+
export function truncate(path: PathLike, len: number | undefined | null, callback: NoParamCallback): void;
|
|
183
312
|
|
|
184
313
|
/**
|
|
185
314
|
* Asynchronous truncate(2) - Truncate a file to a specified length.
|
|
186
315
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
187
316
|
* URL support is _experimental_.
|
|
188
317
|
*/
|
|
189
|
-
function truncate(path: PathLike, callback:
|
|
318
|
+
export function truncate(path: PathLike, callback: NoParamCallback): void;
|
|
190
319
|
|
|
191
320
|
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
192
|
-
namespace truncate {
|
|
321
|
+
export namespace truncate {
|
|
193
322
|
/**
|
|
194
323
|
* Asynchronous truncate(2) - Truncate a file to a specified length.
|
|
195
324
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -203,23 +332,23 @@ declare module "fs" {
|
|
|
203
332
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
204
333
|
* @param len If not specified, defaults to `0`.
|
|
205
334
|
*/
|
|
206
|
-
function truncateSync(path: PathLike, len?: number | null): void;
|
|
335
|
+
export function truncateSync(path: PathLike, len?: number | null): void;
|
|
207
336
|
|
|
208
337
|
/**
|
|
209
338
|
* Asynchronous ftruncate(2) - Truncate a file to a specified length.
|
|
210
339
|
* @param fd A file descriptor.
|
|
211
340
|
* @param len If not specified, defaults to `0`.
|
|
212
341
|
*/
|
|
213
|
-
function ftruncate(fd: number, len: number | undefined | null, callback:
|
|
342
|
+
export function ftruncate(fd: number, len: number | undefined | null, callback: NoParamCallback): void;
|
|
214
343
|
|
|
215
344
|
/**
|
|
216
345
|
* Asynchronous ftruncate(2) - Truncate a file to a specified length.
|
|
217
346
|
* @param fd A file descriptor.
|
|
218
347
|
*/
|
|
219
|
-
function ftruncate(fd: number, callback:
|
|
348
|
+
export function ftruncate(fd: number, callback: NoParamCallback): void;
|
|
220
349
|
|
|
221
350
|
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
222
|
-
namespace ftruncate {
|
|
351
|
+
export namespace ftruncate {
|
|
223
352
|
/**
|
|
224
353
|
* Asynchronous ftruncate(2) - Truncate a file to a specified length.
|
|
225
354
|
* @param fd A file descriptor.
|
|
@@ -233,16 +362,16 @@ declare module "fs" {
|
|
|
233
362
|
* @param fd A file descriptor.
|
|
234
363
|
* @param len If not specified, defaults to `0`.
|
|
235
364
|
*/
|
|
236
|
-
function ftruncateSync(fd: number, len?: number | null): void;
|
|
365
|
+
export function ftruncateSync(fd: number, len?: number | null): void;
|
|
237
366
|
|
|
238
367
|
/**
|
|
239
368
|
* Asynchronous chown(2) - Change ownership of a file.
|
|
240
369
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
241
370
|
*/
|
|
242
|
-
function chown(path: PathLike, uid: number, gid: number, callback:
|
|
371
|
+
export function chown(path: PathLike, uid: number, gid: number, callback: NoParamCallback): void;
|
|
243
372
|
|
|
244
373
|
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
245
|
-
namespace chown {
|
|
374
|
+
export namespace chown {
|
|
246
375
|
/**
|
|
247
376
|
* Asynchronous chown(2) - Change ownership of a file.
|
|
248
377
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -254,16 +383,16 @@ declare module "fs" {
|
|
|
254
383
|
* Synchronous chown(2) - Change ownership of a file.
|
|
255
384
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
256
385
|
*/
|
|
257
|
-
function chownSync(path: PathLike, uid: number, gid: number): void;
|
|
386
|
+
export function chownSync(path: PathLike, uid: number, gid: number): void;
|
|
258
387
|
|
|
259
388
|
/**
|
|
260
389
|
* Asynchronous fchown(2) - Change ownership of a file.
|
|
261
390
|
* @param fd A file descriptor.
|
|
262
391
|
*/
|
|
263
|
-
function fchown(fd: number, uid: number, gid: number, callback:
|
|
392
|
+
export function fchown(fd: number, uid: number, gid: number, callback: NoParamCallback): void;
|
|
264
393
|
|
|
265
394
|
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
266
|
-
namespace fchown {
|
|
395
|
+
export namespace fchown {
|
|
267
396
|
/**
|
|
268
397
|
* Asynchronous fchown(2) - Change ownership of a file.
|
|
269
398
|
* @param fd A file descriptor.
|
|
@@ -275,16 +404,16 @@ declare module "fs" {
|
|
|
275
404
|
* Synchronous fchown(2) - Change ownership of a file.
|
|
276
405
|
* @param fd A file descriptor.
|
|
277
406
|
*/
|
|
278
|
-
function fchownSync(fd: number, uid: number, gid: number): void;
|
|
407
|
+
export function fchownSync(fd: number, uid: number, gid: number): void;
|
|
279
408
|
|
|
280
409
|
/**
|
|
281
410
|
* Asynchronous lchown(2) - Change ownership of a file. Does not dereference symbolic links.
|
|
282
411
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
283
412
|
*/
|
|
284
|
-
function lchown(path: PathLike, uid: number, gid: number, callback:
|
|
413
|
+
export function lchown(path: PathLike, uid: number, gid: number, callback: NoParamCallback): void;
|
|
285
414
|
|
|
286
415
|
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
287
|
-
namespace lchown {
|
|
416
|
+
export namespace lchown {
|
|
288
417
|
/**
|
|
289
418
|
* Asynchronous lchown(2) - Change ownership of a file. Does not dereference symbolic links.
|
|
290
419
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -296,23 +425,56 @@ declare module "fs" {
|
|
|
296
425
|
* Synchronous lchown(2) - Change ownership of a file. Does not dereference symbolic links.
|
|
297
426
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
298
427
|
*/
|
|
299
|
-
function lchownSync(path: PathLike, uid: number, gid: number): void;
|
|
428
|
+
export function lchownSync(path: PathLike, uid: number, gid: number): void;
|
|
429
|
+
|
|
430
|
+
/**
|
|
431
|
+
* Changes the access and modification times of a file in the same way as `fs.utimes()`,
|
|
432
|
+
* with the difference that if the path refers to a symbolic link, then the link is not
|
|
433
|
+
* dereferenced: instead, the timestamps of the symbolic link itself are changed.
|
|
434
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
435
|
+
* @param atime The last access time. If a string is provided, it will be coerced to number.
|
|
436
|
+
* @param mtime The last modified time. If a string is provided, it will be coerced to number.
|
|
437
|
+
*/
|
|
438
|
+
export function lutimes(path: PathLike, atime: string | number | Date, mtime: string | number | Date, callback: NoParamCallback): void;
|
|
439
|
+
|
|
440
|
+
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
441
|
+
export namespace lutimes {
|
|
442
|
+
/**
|
|
443
|
+
* Changes the access and modification times of a file in the same way as `fsPromises.utimes()`,
|
|
444
|
+
* with the difference that if the path refers to a symbolic link, then the link is not
|
|
445
|
+
* dereferenced: instead, the timestamps of the symbolic link itself are changed.
|
|
446
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
447
|
+
* @param atime The last access time. If a string is provided, it will be coerced to number.
|
|
448
|
+
* @param mtime The last modified time. If a string is provided, it will be coerced to number.
|
|
449
|
+
*/
|
|
450
|
+
function __promisify__(path: PathLike, atime: string | number | Date, mtime: string | number | Date): Promise<void>;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
/**
|
|
454
|
+
* Change the file system timestamps of the symbolic link referenced by `path`. Returns `undefined`,
|
|
455
|
+
* or throws an exception when parameters are incorrect or the operation fails.
|
|
456
|
+
* This is the synchronous version of `fs.lutimes()`.
|
|
457
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
458
|
+
* @param atime The last access time. If a string is provided, it will be coerced to number.
|
|
459
|
+
* @param mtime The last modified time. If a string is provided, it will be coerced to number.
|
|
460
|
+
*/
|
|
461
|
+
export function lutimesSync(path: PathLike, atime: string | number | Date, mtime: string | number | Date): void;
|
|
300
462
|
|
|
301
463
|
/**
|
|
302
464
|
* Asynchronous chmod(2) - Change permissions of a file.
|
|
303
465
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
304
466
|
* @param mode A file mode. If a string is passed, it is parsed as an octal integer.
|
|
305
467
|
*/
|
|
306
|
-
function chmod(path: PathLike, mode:
|
|
468
|
+
export function chmod(path: PathLike, mode: Mode, callback: NoParamCallback): void;
|
|
307
469
|
|
|
308
470
|
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
309
|
-
namespace chmod {
|
|
471
|
+
export namespace chmod {
|
|
310
472
|
/**
|
|
311
473
|
* Asynchronous chmod(2) - Change permissions of a file.
|
|
312
474
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
313
475
|
* @param mode A file mode. If a string is passed, it is parsed as an octal integer.
|
|
314
476
|
*/
|
|
315
|
-
function __promisify__(path: PathLike, mode:
|
|
477
|
+
function __promisify__(path: PathLike, mode: Mode): Promise<void>;
|
|
316
478
|
}
|
|
317
479
|
|
|
318
480
|
/**
|
|
@@ -320,23 +482,23 @@ declare module "fs" {
|
|
|
320
482
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
321
483
|
* @param mode A file mode. If a string is passed, it is parsed as an octal integer.
|
|
322
484
|
*/
|
|
323
|
-
function chmodSync(path: PathLike, mode:
|
|
485
|
+
export function chmodSync(path: PathLike, mode: Mode): void;
|
|
324
486
|
|
|
325
487
|
/**
|
|
326
488
|
* Asynchronous fchmod(2) - Change permissions of a file.
|
|
327
489
|
* @param fd A file descriptor.
|
|
328
490
|
* @param mode A file mode. If a string is passed, it is parsed as an octal integer.
|
|
329
491
|
*/
|
|
330
|
-
function fchmod(fd: number, mode:
|
|
492
|
+
export function fchmod(fd: number, mode: Mode, callback: NoParamCallback): void;
|
|
331
493
|
|
|
332
494
|
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
333
|
-
namespace fchmod {
|
|
495
|
+
export namespace fchmod {
|
|
334
496
|
/**
|
|
335
497
|
* Asynchronous fchmod(2) - Change permissions of a file.
|
|
336
498
|
* @param fd A file descriptor.
|
|
337
499
|
* @param mode A file mode. If a string is passed, it is parsed as an octal integer.
|
|
338
500
|
*/
|
|
339
|
-
function __promisify__(fd: number, mode:
|
|
501
|
+
function __promisify__(fd: number, mode: Mode): Promise<void>;
|
|
340
502
|
}
|
|
341
503
|
|
|
342
504
|
/**
|
|
@@ -344,23 +506,23 @@ declare module "fs" {
|
|
|
344
506
|
* @param fd A file descriptor.
|
|
345
507
|
* @param mode A file mode. If a string is passed, it is parsed as an octal integer.
|
|
346
508
|
*/
|
|
347
|
-
function fchmodSync(fd: number, mode:
|
|
509
|
+
export function fchmodSync(fd: number, mode: Mode): void;
|
|
348
510
|
|
|
349
511
|
/**
|
|
350
512
|
* Asynchronous lchmod(2) - Change permissions of a file. Does not dereference symbolic links.
|
|
351
513
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
352
514
|
* @param mode A file mode. If a string is passed, it is parsed as an octal integer.
|
|
353
515
|
*/
|
|
354
|
-
function lchmod(path: PathLike, mode:
|
|
516
|
+
export function lchmod(path: PathLike, mode: Mode, callback: NoParamCallback): void;
|
|
355
517
|
|
|
356
518
|
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
357
|
-
namespace lchmod {
|
|
519
|
+
export namespace lchmod {
|
|
358
520
|
/**
|
|
359
521
|
* Asynchronous lchmod(2) - Change permissions of a file. Does not dereference symbolic links.
|
|
360
522
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
361
523
|
* @param mode A file mode. If a string is passed, it is parsed as an octal integer.
|
|
362
524
|
*/
|
|
363
|
-
function __promisify__(path: PathLike, mode:
|
|
525
|
+
function __promisify__(path: PathLike, mode: Mode): Promise<void>;
|
|
364
526
|
}
|
|
365
527
|
|
|
366
528
|
/**
|
|
@@ -368,80 +530,101 @@ declare module "fs" {
|
|
|
368
530
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
369
531
|
* @param mode A file mode. If a string is passed, it is parsed as an octal integer.
|
|
370
532
|
*/
|
|
371
|
-
function lchmodSync(path: PathLike, mode:
|
|
533
|
+
export function lchmodSync(path: PathLike, mode: Mode): void;
|
|
372
534
|
|
|
373
535
|
/**
|
|
374
536
|
* Asynchronous stat(2) - Get file status.
|
|
375
537
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
376
538
|
*/
|
|
377
|
-
function stat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
|
|
539
|
+
export function stat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
|
|
540
|
+
export function stat(path: PathLike, options: StatOptions & { bigint?: false | undefined } | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
|
|
541
|
+
export function stat(path: PathLike, options: StatOptions & { bigint: true }, callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void): void;
|
|
542
|
+
export function stat(path: PathLike, options: StatOptions | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void): void;
|
|
378
543
|
|
|
379
544
|
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
380
|
-
namespace stat {
|
|
545
|
+
export namespace stat {
|
|
381
546
|
/**
|
|
382
547
|
* Asynchronous stat(2) - Get file status.
|
|
383
548
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
384
549
|
*/
|
|
385
|
-
function __promisify__(path: PathLike): Promise<Stats>;
|
|
550
|
+
function __promisify__(path: PathLike, options?: StatOptions & { bigint?: false | undefined }): Promise<Stats>;
|
|
551
|
+
function __promisify__(path: PathLike, options: StatOptions & { bigint: true }): Promise<BigIntStats>;
|
|
552
|
+
function __promisify__(path: PathLike, options?: StatOptions): Promise<Stats | BigIntStats>;
|
|
386
553
|
}
|
|
387
554
|
|
|
388
555
|
/**
|
|
389
556
|
* Synchronous stat(2) - Get file status.
|
|
390
557
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
391
558
|
*/
|
|
392
|
-
function statSync(path: PathLike): Stats;
|
|
559
|
+
export function statSync(path: PathLike, options?: StatOptions & { bigint?: false | undefined }): Stats;
|
|
560
|
+
export function statSync(path: PathLike, options: StatOptions & { bigint: true }): BigIntStats;
|
|
561
|
+
export function statSync(path: PathLike, options?: StatOptions): Stats | BigIntStats;
|
|
393
562
|
|
|
394
563
|
/**
|
|
395
564
|
* Asynchronous fstat(2) - Get file status.
|
|
396
565
|
* @param fd A file descriptor.
|
|
397
566
|
*/
|
|
398
|
-
function fstat(fd: number, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
|
|
567
|
+
export function fstat(fd: number, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
|
|
568
|
+
export function fstat(fd: number, options: StatOptions & { bigint?: false | undefined } | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
|
|
569
|
+
export function fstat(fd: number, options: StatOptions & { bigint: true }, callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void): void;
|
|
570
|
+
export function fstat(fd: number, options: StatOptions | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void): void;
|
|
399
571
|
|
|
400
572
|
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
401
|
-
namespace fstat {
|
|
573
|
+
export namespace fstat {
|
|
402
574
|
/**
|
|
403
575
|
* Asynchronous fstat(2) - Get file status.
|
|
404
576
|
* @param fd A file descriptor.
|
|
405
577
|
*/
|
|
406
|
-
function __promisify__(fd: number): Promise<Stats>;
|
|
578
|
+
function __promisify__(fd: number, options?: StatOptions & { bigint?: false | undefined }): Promise<Stats>;
|
|
579
|
+
function __promisify__(fd: number, options: StatOptions & { bigint: true }): Promise<BigIntStats>;
|
|
580
|
+
function __promisify__(fd: number, options?: StatOptions): Promise<Stats | BigIntStats>;
|
|
407
581
|
}
|
|
408
582
|
|
|
409
583
|
/**
|
|
410
584
|
* Synchronous fstat(2) - Get file status.
|
|
411
585
|
* @param fd A file descriptor.
|
|
412
586
|
*/
|
|
413
|
-
function fstatSync(fd: number): Stats;
|
|
587
|
+
export function fstatSync(fd: number, options?: StatOptions & { bigint?: false | undefined }): Stats;
|
|
588
|
+
export function fstatSync(fd: number, options: StatOptions & { bigint: true }): BigIntStats;
|
|
589
|
+
export function fstatSync(fd: number, options?: StatOptions): Stats | BigIntStats;
|
|
414
590
|
|
|
415
591
|
/**
|
|
416
592
|
* Asynchronous lstat(2) - Get file status. Does not dereference symbolic links.
|
|
417
593
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
418
594
|
*/
|
|
419
|
-
function lstat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
|
|
595
|
+
export function lstat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
|
|
596
|
+
export function lstat(path: PathLike, options: StatOptions & { bigint?: false | undefined } | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
|
|
597
|
+
export function lstat(path: PathLike, options: StatOptions & { bigint: true }, callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void): void;
|
|
598
|
+
export function lstat(path: PathLike, options: StatOptions | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void): void;
|
|
420
599
|
|
|
421
600
|
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
422
|
-
namespace lstat {
|
|
601
|
+
export namespace lstat {
|
|
423
602
|
/**
|
|
424
603
|
* Asynchronous lstat(2) - Get file status. Does not dereference symbolic links.
|
|
425
604
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
426
605
|
*/
|
|
427
|
-
function __promisify__(path: PathLike): Promise<Stats>;
|
|
606
|
+
function __promisify__(path: PathLike, options?: StatOptions & { bigint?: false | undefined }): Promise<Stats>;
|
|
607
|
+
function __promisify__(path: PathLike, options: StatOptions & { bigint: true }): Promise<BigIntStats>;
|
|
608
|
+
function __promisify__(path: PathLike, options?: StatOptions): Promise<Stats | BigIntStats>;
|
|
428
609
|
}
|
|
429
610
|
|
|
430
611
|
/**
|
|
431
612
|
* Synchronous lstat(2) - Get file status. Does not dereference symbolic links.
|
|
432
613
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
433
614
|
*/
|
|
434
|
-
function lstatSync(path: PathLike): Stats;
|
|
615
|
+
export function lstatSync(path: PathLike, options?: StatOptions & { bigint?: false | undefined }): Stats;
|
|
616
|
+
export function lstatSync(path: PathLike, options: StatOptions & { bigint: true }): BigIntStats;
|
|
617
|
+
export function lstatSync(path: PathLike, options?: StatOptions): Stats | BigIntStats;
|
|
435
618
|
|
|
436
619
|
/**
|
|
437
620
|
* Asynchronous link(2) - Create a new link (also known as a hard link) to an existing file.
|
|
438
621
|
* @param existingPath A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
439
622
|
* @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
440
623
|
*/
|
|
441
|
-
function link(existingPath: PathLike, newPath: PathLike, callback:
|
|
624
|
+
export function link(existingPath: PathLike, newPath: PathLike, callback: NoParamCallback): void;
|
|
442
625
|
|
|
443
626
|
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
444
|
-
namespace link {
|
|
627
|
+
export namespace link {
|
|
445
628
|
/**
|
|
446
629
|
* Asynchronous link(2) - Create a new link (also known as a hard link) to an existing file.
|
|
447
630
|
* @param existingPath A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -455,7 +638,7 @@ declare module "fs" {
|
|
|
455
638
|
* @param existingPath A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
456
639
|
* @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
457
640
|
*/
|
|
458
|
-
function linkSync(existingPath: PathLike, newPath: PathLike): void;
|
|
641
|
+
export function linkSync(existingPath: PathLike, newPath: PathLike): void;
|
|
459
642
|
|
|
460
643
|
/**
|
|
461
644
|
* Asynchronous symlink(2) - Create a new symbolic link to an existing file.
|
|
@@ -464,17 +647,17 @@ declare module "fs" {
|
|
|
464
647
|
* @param type May be set to `'dir'`, `'file'`, or `'junction'` (default is `'file'`) and is only available on Windows (ignored on other platforms).
|
|
465
648
|
* When using `'junction'`, the `target` argument will automatically be normalized to an absolute path.
|
|
466
649
|
*/
|
|
467
|
-
function symlink(target: PathLike, path: PathLike, type: symlink.Type | undefined | null, callback:
|
|
650
|
+
export function symlink(target: PathLike, path: PathLike, type: symlink.Type | undefined | null, callback: NoParamCallback): void;
|
|
468
651
|
|
|
469
652
|
/**
|
|
470
653
|
* Asynchronous symlink(2) - Create a new symbolic link to an existing file.
|
|
471
654
|
* @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol.
|
|
472
655
|
* @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol.
|
|
473
656
|
*/
|
|
474
|
-
function symlink(target: PathLike, path: PathLike, callback:
|
|
657
|
+
export function symlink(target: PathLike, path: PathLike, callback: NoParamCallback): void;
|
|
475
658
|
|
|
476
659
|
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
477
|
-
namespace symlink {
|
|
660
|
+
export namespace symlink {
|
|
478
661
|
/**
|
|
479
662
|
* Asynchronous symlink(2) - Create a new symbolic link to an existing file.
|
|
480
663
|
* @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -494,16 +677,16 @@ declare module "fs" {
|
|
|
494
677
|
* @param type May be set to `'dir'`, `'file'`, or `'junction'` (default is `'file'`) and is only available on Windows (ignored on other platforms).
|
|
495
678
|
* When using `'junction'`, the `target` argument will automatically be normalized to an absolute path.
|
|
496
679
|
*/
|
|
497
|
-
function symlinkSync(target: PathLike, path: PathLike, type?: symlink.Type | null): void;
|
|
680
|
+
export function symlinkSync(target: PathLike, path: PathLike, type?: symlink.Type | null): void;
|
|
498
681
|
|
|
499
682
|
/**
|
|
500
683
|
* Asynchronous readlink(2) - read value of a symbolic link.
|
|
501
684
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
502
685
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
503
686
|
*/
|
|
504
|
-
function readlink(
|
|
687
|
+
export function readlink(
|
|
505
688
|
path: PathLike,
|
|
506
|
-
options:
|
|
689
|
+
options: BaseEncodingOptions | BufferEncoding | undefined | null,
|
|
507
690
|
callback: (err: NodeJS.ErrnoException | null, linkString: string) => void
|
|
508
691
|
): void;
|
|
509
692
|
|
|
@@ -512,43 +695,43 @@ declare module "fs" {
|
|
|
512
695
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
513
696
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
514
697
|
*/
|
|
515
|
-
function readlink(path: PathLike, options:
|
|
698
|
+
export function readlink(path: PathLike, options: BufferEncodingOption, callback: (err: NodeJS.ErrnoException | null, linkString: Buffer) => void): void;
|
|
516
699
|
|
|
517
700
|
/**
|
|
518
701
|
* Asynchronous readlink(2) - read value of a symbolic link.
|
|
519
702
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
520
703
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
521
704
|
*/
|
|
522
|
-
function readlink(path: PathLike, options:
|
|
705
|
+
export function readlink(path: PathLike, options: BaseEncodingOptions | string | undefined | null, callback: (err: NodeJS.ErrnoException | null, linkString: string | Buffer) => void): void;
|
|
523
706
|
|
|
524
707
|
/**
|
|
525
708
|
* Asynchronous readlink(2) - read value of a symbolic link.
|
|
526
709
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
527
710
|
*/
|
|
528
|
-
function readlink(path: PathLike, callback: (err: NodeJS.ErrnoException | null, linkString: string) => void): void;
|
|
711
|
+
export function readlink(path: PathLike, callback: (err: NodeJS.ErrnoException | null, linkString: string) => void): void;
|
|
529
712
|
|
|
530
713
|
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
531
|
-
namespace readlink {
|
|
714
|
+
export namespace readlink {
|
|
532
715
|
/**
|
|
533
716
|
* Asynchronous readlink(2) - read value of a symbolic link.
|
|
534
717
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
535
718
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
536
719
|
*/
|
|
537
|
-
function __promisify__(path: PathLike, options?:
|
|
720
|
+
function __promisify__(path: PathLike, options?: BaseEncodingOptions | BufferEncoding | null): Promise<string>;
|
|
538
721
|
|
|
539
722
|
/**
|
|
540
723
|
* Asynchronous readlink(2) - read value of a symbolic link.
|
|
541
724
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
542
725
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
543
726
|
*/
|
|
544
|
-
function __promisify__(path: PathLike, options:
|
|
727
|
+
function __promisify__(path: PathLike, options: BufferEncodingOption): Promise<Buffer>;
|
|
545
728
|
|
|
546
729
|
/**
|
|
547
730
|
* Asynchronous readlink(2) - read value of a symbolic link.
|
|
548
731
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
549
732
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
550
733
|
*/
|
|
551
|
-
function __promisify__(path: PathLike, options?:
|
|
734
|
+
function __promisify__(path: PathLike, options?: BaseEncodingOptions | string | null): Promise<string | Buffer>;
|
|
552
735
|
}
|
|
553
736
|
|
|
554
737
|
/**
|
|
@@ -556,30 +739,30 @@ declare module "fs" {
|
|
|
556
739
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
557
740
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
558
741
|
*/
|
|
559
|
-
function readlinkSync(path: PathLike, options?:
|
|
742
|
+
export function readlinkSync(path: PathLike, options?: BaseEncodingOptions | BufferEncoding | null): string;
|
|
560
743
|
|
|
561
744
|
/**
|
|
562
745
|
* Synchronous readlink(2) - read value of a symbolic link.
|
|
563
746
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
564
747
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
565
748
|
*/
|
|
566
|
-
function readlinkSync(path: PathLike, options:
|
|
749
|
+
export function readlinkSync(path: PathLike, options: BufferEncodingOption): Buffer;
|
|
567
750
|
|
|
568
751
|
/**
|
|
569
752
|
* Synchronous readlink(2) - read value of a symbolic link.
|
|
570
753
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
571
754
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
572
755
|
*/
|
|
573
|
-
function readlinkSync(path: PathLike, options?:
|
|
756
|
+
export function readlinkSync(path: PathLike, options?: BaseEncodingOptions | string | null): string | Buffer;
|
|
574
757
|
|
|
575
758
|
/**
|
|
576
759
|
* Asynchronous realpath(3) - return the canonicalized absolute pathname.
|
|
577
760
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
578
761
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
579
762
|
*/
|
|
580
|
-
function realpath(
|
|
763
|
+
export function realpath(
|
|
581
764
|
path: PathLike,
|
|
582
|
-
options:
|
|
765
|
+
options: BaseEncodingOptions | BufferEncoding | undefined | null,
|
|
583
766
|
callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void
|
|
584
767
|
): void;
|
|
585
768
|
|
|
@@ -588,51 +771,51 @@ declare module "fs" {
|
|
|
588
771
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
589
772
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
590
773
|
*/
|
|
591
|
-
function realpath(path: PathLike, options:
|
|
774
|
+
export function realpath(path: PathLike, options: BufferEncodingOption, callback: (err: NodeJS.ErrnoException | null, resolvedPath: Buffer) => void): void;
|
|
592
775
|
|
|
593
776
|
/**
|
|
594
777
|
* Asynchronous realpath(3) - return the canonicalized absolute pathname.
|
|
595
778
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
596
779
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
597
780
|
*/
|
|
598
|
-
function realpath(path: PathLike, options:
|
|
781
|
+
export function realpath(path: PathLike, options: BaseEncodingOptions | string | undefined | null, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | Buffer) => void): void;
|
|
599
782
|
|
|
600
783
|
/**
|
|
601
784
|
* Asynchronous realpath(3) - return the canonicalized absolute pathname.
|
|
602
785
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
603
786
|
*/
|
|
604
|
-
function realpath(path: PathLike, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void): void;
|
|
787
|
+
export function realpath(path: PathLike, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void): void;
|
|
605
788
|
|
|
606
789
|
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
607
|
-
namespace realpath {
|
|
790
|
+
export namespace realpath {
|
|
608
791
|
/**
|
|
609
792
|
* Asynchronous realpath(3) - return the canonicalized absolute pathname.
|
|
610
793
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
611
794
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
612
795
|
*/
|
|
613
|
-
function __promisify__(path: PathLike, options?:
|
|
796
|
+
function __promisify__(path: PathLike, options?: BaseEncodingOptions | BufferEncoding | null): Promise<string>;
|
|
614
797
|
|
|
615
798
|
/**
|
|
616
799
|
* Asynchronous realpath(3) - return the canonicalized absolute pathname.
|
|
617
800
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
618
801
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
619
802
|
*/
|
|
620
|
-
function __promisify__(path: PathLike, options:
|
|
803
|
+
function __promisify__(path: PathLike, options: BufferEncodingOption): Promise<Buffer>;
|
|
621
804
|
|
|
622
805
|
/**
|
|
623
806
|
* Asynchronous realpath(3) - return the canonicalized absolute pathname.
|
|
624
807
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
625
808
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
626
809
|
*/
|
|
627
|
-
function __promisify__(path: PathLike, options?:
|
|
810
|
+
function __promisify__(path: PathLike, options?: BaseEncodingOptions | string | null): Promise<string | Buffer>;
|
|
628
811
|
|
|
629
812
|
function native(
|
|
630
813
|
path: PathLike,
|
|
631
|
-
options:
|
|
814
|
+
options: BaseEncodingOptions | BufferEncoding | undefined | null,
|
|
632
815
|
callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void
|
|
633
816
|
): void;
|
|
634
|
-
function native(path: PathLike, options:
|
|
635
|
-
function native(path: PathLike, options:
|
|
817
|
+
function native(path: PathLike, options: BufferEncodingOption, callback: (err: NodeJS.ErrnoException | null, resolvedPath: Buffer) => void): void;
|
|
818
|
+
function native(path: PathLike, options: BaseEncodingOptions | string | undefined | null, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | Buffer) => void): void;
|
|
636
819
|
function native(path: PathLike, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void): void;
|
|
637
820
|
}
|
|
638
821
|
|
|
@@ -641,36 +824,36 @@ declare module "fs" {
|
|
|
641
824
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
642
825
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
643
826
|
*/
|
|
644
|
-
function realpathSync(path: PathLike, options?:
|
|
827
|
+
export function realpathSync(path: PathLike, options?: BaseEncodingOptions | BufferEncoding | null): string;
|
|
645
828
|
|
|
646
829
|
/**
|
|
647
830
|
* Synchronous realpath(3) - return the canonicalized absolute pathname.
|
|
648
831
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
649
832
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
650
833
|
*/
|
|
651
|
-
function realpathSync(path: PathLike, options:
|
|
834
|
+
export function realpathSync(path: PathLike, options: BufferEncodingOption): Buffer;
|
|
652
835
|
|
|
653
836
|
/**
|
|
654
837
|
* Synchronous realpath(3) - return the canonicalized absolute pathname.
|
|
655
838
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
656
839
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
657
840
|
*/
|
|
658
|
-
function realpathSync(path: PathLike, options?:
|
|
841
|
+
export function realpathSync(path: PathLike, options?: BaseEncodingOptions | string | null): string | Buffer;
|
|
659
842
|
|
|
660
|
-
namespace realpathSync {
|
|
661
|
-
function native(path: PathLike, options?:
|
|
662
|
-
function native(path: PathLike, options:
|
|
663
|
-
function native(path: PathLike, options?:
|
|
843
|
+
export namespace realpathSync {
|
|
844
|
+
function native(path: PathLike, options?: BaseEncodingOptions | BufferEncoding | null): string;
|
|
845
|
+
function native(path: PathLike, options: BufferEncodingOption): Buffer;
|
|
846
|
+
function native(path: PathLike, options?: BaseEncodingOptions | string | null): string | Buffer;
|
|
664
847
|
}
|
|
665
848
|
|
|
666
849
|
/**
|
|
667
850
|
* Asynchronous unlink(2) - delete a name and possibly the file it refers to.
|
|
668
851
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
669
852
|
*/
|
|
670
|
-
function unlink(path: PathLike, callback:
|
|
853
|
+
export function unlink(path: PathLike, callback: NoParamCallback): void;
|
|
671
854
|
|
|
672
855
|
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
673
|
-
namespace unlink {
|
|
856
|
+
export namespace unlink {
|
|
674
857
|
/**
|
|
675
858
|
* Asynchronous unlink(2) - delete a name and possibly the file it refers to.
|
|
676
859
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -682,40 +865,121 @@ declare module "fs" {
|
|
|
682
865
|
* Synchronous unlink(2) - delete a name and possibly the file it refers to.
|
|
683
866
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
684
867
|
*/
|
|
685
|
-
function unlinkSync(path: PathLike): void;
|
|
868
|
+
export function unlinkSync(path: PathLike): void;
|
|
869
|
+
|
|
870
|
+
export interface RmDirOptions {
|
|
871
|
+
/**
|
|
872
|
+
* If an `EBUSY`, `EMFILE`, `ENFILE`, `ENOTEMPTY`, or
|
|
873
|
+
* `EPERM` error is encountered, Node.js will retry the operation with a linear
|
|
874
|
+
* backoff wait of `retryDelay` ms longer on each try. This option represents the
|
|
875
|
+
* number of retries. This option is ignored if the `recursive` option is not
|
|
876
|
+
* `true`.
|
|
877
|
+
* @default 0
|
|
878
|
+
*/
|
|
879
|
+
maxRetries?: number | undefined;
|
|
880
|
+
/**
|
|
881
|
+
* @deprecated since v14.14.0 In future versions of Node.js,
|
|
882
|
+
* `fs.rmdir(path, { recursive: true })` will throw on nonexistent
|
|
883
|
+
* paths, or when given a file as a target.
|
|
884
|
+
* Use `fs.rm(path, { recursive: true, force: true })` instead.
|
|
885
|
+
*
|
|
886
|
+
* If `true`, perform a recursive directory removal. In
|
|
887
|
+
* recursive mode, errors are not reported if `path` does not exist, and
|
|
888
|
+
* operations are retried on failure.
|
|
889
|
+
* @default false
|
|
890
|
+
*/
|
|
891
|
+
recursive?: boolean | undefined;
|
|
892
|
+
/**
|
|
893
|
+
* The amount of time in milliseconds to wait between retries.
|
|
894
|
+
* This option is ignored if the `recursive` option is not `true`.
|
|
895
|
+
* @default 100
|
|
896
|
+
*/
|
|
897
|
+
retryDelay?: number | undefined;
|
|
898
|
+
}
|
|
686
899
|
|
|
687
900
|
/**
|
|
688
901
|
* Asynchronous rmdir(2) - delete a directory.
|
|
689
902
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
690
903
|
*/
|
|
691
|
-
function rmdir(path: PathLike, callback:
|
|
904
|
+
export function rmdir(path: PathLike, callback: NoParamCallback): void;
|
|
905
|
+
export function rmdir(path: PathLike, options: RmDirOptions, callback: NoParamCallback): void;
|
|
692
906
|
|
|
693
907
|
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
694
|
-
namespace rmdir {
|
|
908
|
+
export namespace rmdir {
|
|
695
909
|
/**
|
|
696
910
|
* Asynchronous rmdir(2) - delete a directory.
|
|
697
911
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
698
912
|
*/
|
|
699
|
-
function __promisify__(path: PathLike): Promise<void>;
|
|
913
|
+
function __promisify__(path: PathLike, options?: RmDirOptions): Promise<void>;
|
|
700
914
|
}
|
|
701
915
|
|
|
702
916
|
/**
|
|
703
917
|
* Synchronous rmdir(2) - delete a directory.
|
|
704
918
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
705
919
|
*/
|
|
706
|
-
function rmdirSync(path: PathLike): void;
|
|
920
|
+
export function rmdirSync(path: PathLike, options?: RmDirOptions): void;
|
|
921
|
+
|
|
922
|
+
export interface RmOptions {
|
|
923
|
+
/**
|
|
924
|
+
* When `true`, exceptions will be ignored if `path` does not exist.
|
|
925
|
+
* @default false
|
|
926
|
+
*/
|
|
927
|
+
force?: boolean | undefined;
|
|
928
|
+
/**
|
|
929
|
+
* If an `EBUSY`, `EMFILE`, `ENFILE`, `ENOTEMPTY`, or
|
|
930
|
+
* `EPERM` error is encountered, Node.js will retry the operation with a linear
|
|
931
|
+
* backoff wait of `retryDelay` ms longer on each try. This option represents the
|
|
932
|
+
* number of retries. This option is ignored if the `recursive` option is not
|
|
933
|
+
* `true`.
|
|
934
|
+
* @default 0
|
|
935
|
+
*/
|
|
936
|
+
maxRetries?: number | undefined;
|
|
937
|
+
/**
|
|
938
|
+
* If `true`, perform a recursive directory removal. In
|
|
939
|
+
* recursive mode, errors are not reported if `path` does not exist, and
|
|
940
|
+
* operations are retried on failure.
|
|
941
|
+
* @default false
|
|
942
|
+
*/
|
|
943
|
+
recursive?: boolean | undefined;
|
|
944
|
+
/**
|
|
945
|
+
* The amount of time in milliseconds to wait between retries.
|
|
946
|
+
* This option is ignored if the `recursive` option is not `true`.
|
|
947
|
+
* @default 100
|
|
948
|
+
*/
|
|
949
|
+
retryDelay?: number | undefined;
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
/**
|
|
953
|
+
* Asynchronously removes files and directories (modeled on the standard POSIX `rm` utility).
|
|
954
|
+
*/
|
|
955
|
+
export function rm(path: PathLike, callback: NoParamCallback): void;
|
|
956
|
+
export function rm(path: PathLike, options: RmOptions, callback: NoParamCallback): void;
|
|
957
|
+
|
|
958
|
+
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
959
|
+
export namespace rm {
|
|
960
|
+
/**
|
|
961
|
+
* Asynchronously removes files and directories (modeled on the standard POSIX `rm` utility).
|
|
962
|
+
*/
|
|
963
|
+
function __promisify__(path: PathLike, options?: RmOptions): Promise<void>;
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
/**
|
|
967
|
+
* Synchronously removes files and directories (modeled on the standard POSIX `rm` utility).
|
|
968
|
+
*/
|
|
969
|
+
export function rmSync(path: PathLike, options?: RmOptions): void;
|
|
707
970
|
|
|
708
971
|
export interface MakeDirectoryOptions {
|
|
709
972
|
/**
|
|
710
973
|
* Indicates whether parent folders should be created.
|
|
974
|
+
* If a folder was created, the path to the first created folder will be returned.
|
|
711
975
|
* @default false
|
|
712
976
|
*/
|
|
713
|
-
recursive?: boolean;
|
|
977
|
+
recursive?: boolean | undefined;
|
|
714
978
|
/**
|
|
715
979
|
* A file mode. If a string is passed, it is parsed as an octal integer. If not specified
|
|
716
|
-
* @default 0o777
|
|
980
|
+
* @default 0o777
|
|
717
981
|
*/
|
|
718
|
-
mode?:
|
|
982
|
+
mode?: Mode | undefined;
|
|
719
983
|
}
|
|
720
984
|
|
|
721
985
|
/**
|
|
@@ -724,23 +988,55 @@ declare module "fs" {
|
|
|
724
988
|
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
|
|
725
989
|
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
|
|
726
990
|
*/
|
|
727
|
-
function mkdir(path: PathLike, options:
|
|
991
|
+
export function mkdir(path: PathLike, options: MakeDirectoryOptions & { recursive: true }, callback: (err: NodeJS.ErrnoException | null, path?: string) => void): void;
|
|
992
|
+
|
|
993
|
+
/**
|
|
994
|
+
* Asynchronous mkdir(2) - create a directory.
|
|
995
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
996
|
+
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
|
|
997
|
+
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
|
|
998
|
+
*/
|
|
999
|
+
export function mkdir(path: PathLike, options: Mode | (MakeDirectoryOptions & { recursive?: false | undefined; }) | null | undefined, callback: NoParamCallback): void;
|
|
1000
|
+
|
|
1001
|
+
/**
|
|
1002
|
+
* Asynchronous mkdir(2) - create a directory.
|
|
1003
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1004
|
+
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
|
|
1005
|
+
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
|
|
1006
|
+
*/
|
|
1007
|
+
export function mkdir(path: PathLike, options: Mode | MakeDirectoryOptions | null | undefined, callback: (err: NodeJS.ErrnoException | null, path?: string) => void): void;
|
|
728
1008
|
|
|
729
1009
|
/**
|
|
730
1010
|
* Asynchronous mkdir(2) - create a directory with a mode of `0o777`.
|
|
731
1011
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
732
1012
|
*/
|
|
733
|
-
function mkdir(path: PathLike, callback:
|
|
1013
|
+
export function mkdir(path: PathLike, callback: NoParamCallback): void;
|
|
734
1014
|
|
|
735
1015
|
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
736
|
-
namespace mkdir {
|
|
1016
|
+
export namespace mkdir {
|
|
1017
|
+
/**
|
|
1018
|
+
* Asynchronous mkdir(2) - create a directory.
|
|
1019
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1020
|
+
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
|
|
1021
|
+
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
|
|
1022
|
+
*/
|
|
1023
|
+
function __promisify__(path: PathLike, options: MakeDirectoryOptions & { recursive: true; }): Promise<string | undefined>;
|
|
1024
|
+
|
|
737
1025
|
/**
|
|
738
1026
|
* Asynchronous mkdir(2) - create a directory.
|
|
739
1027
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
740
1028
|
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
|
|
741
1029
|
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
|
|
742
1030
|
*/
|
|
743
|
-
function __promisify__(path: PathLike, options?:
|
|
1031
|
+
function __promisify__(path: PathLike, options?: Mode | (MakeDirectoryOptions & { recursive?: false | undefined; }) | null): Promise<void>;
|
|
1032
|
+
|
|
1033
|
+
/**
|
|
1034
|
+
* Asynchronous mkdir(2) - create a directory.
|
|
1035
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1036
|
+
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
|
|
1037
|
+
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
|
|
1038
|
+
*/
|
|
1039
|
+
function __promisify__(path: PathLike, options?: Mode | MakeDirectoryOptions | null): Promise<string | undefined>;
|
|
744
1040
|
}
|
|
745
1041
|
|
|
746
1042
|
/**
|
|
@@ -749,57 +1045,73 @@ declare module "fs" {
|
|
|
749
1045
|
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
|
|
750
1046
|
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
|
|
751
1047
|
*/
|
|
752
|
-
function mkdirSync(path: PathLike, options
|
|
1048
|
+
export function mkdirSync(path: PathLike, options: MakeDirectoryOptions & { recursive: true; }): string | undefined;
|
|
1049
|
+
|
|
1050
|
+
/**
|
|
1051
|
+
* Synchronous mkdir(2) - create a directory.
|
|
1052
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1053
|
+
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
|
|
1054
|
+
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
|
|
1055
|
+
*/
|
|
1056
|
+
export function mkdirSync(path: PathLike, options?: Mode | (MakeDirectoryOptions & { recursive?: false | undefined; }) | null): void;
|
|
1057
|
+
|
|
1058
|
+
/**
|
|
1059
|
+
* Synchronous mkdir(2) - create a directory.
|
|
1060
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1061
|
+
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
|
|
1062
|
+
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
|
|
1063
|
+
*/
|
|
1064
|
+
export function mkdirSync(path: PathLike, options?: Mode | MakeDirectoryOptions | null): string | undefined;
|
|
753
1065
|
|
|
754
1066
|
/**
|
|
755
1067
|
* Asynchronously creates a unique temporary directory.
|
|
756
1068
|
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
|
757
1069
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
758
1070
|
*/
|
|
759
|
-
function mkdtemp(prefix: string, options:
|
|
1071
|
+
export function mkdtemp(prefix: string, options: BaseEncodingOptions | BufferEncoding | undefined | null, callback: (err: NodeJS.ErrnoException | null, folder: string) => void): void;
|
|
760
1072
|
|
|
761
1073
|
/**
|
|
762
1074
|
* Asynchronously creates a unique temporary directory.
|
|
763
1075
|
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
|
764
1076
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
765
1077
|
*/
|
|
766
|
-
function mkdtemp(prefix: string, options: "buffer" | { encoding: "buffer" }, callback: (err: NodeJS.ErrnoException | null, folder: Buffer) => void): void;
|
|
1078
|
+
export function mkdtemp(prefix: string, options: "buffer" | { encoding: "buffer" }, callback: (err: NodeJS.ErrnoException | null, folder: Buffer) => void): void;
|
|
767
1079
|
|
|
768
1080
|
/**
|
|
769
1081
|
* Asynchronously creates a unique temporary directory.
|
|
770
1082
|
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
|
771
1083
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
772
1084
|
*/
|
|
773
|
-
function mkdtemp(prefix: string, options:
|
|
1085
|
+
export function mkdtemp(prefix: string, options: BaseEncodingOptions | string | undefined | null, callback: (err: NodeJS.ErrnoException | null, folder: string | Buffer) => void): void;
|
|
774
1086
|
|
|
775
1087
|
/**
|
|
776
1088
|
* Asynchronously creates a unique temporary directory.
|
|
777
1089
|
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
|
778
1090
|
*/
|
|
779
|
-
function mkdtemp(prefix: string, callback: (err: NodeJS.ErrnoException | null, folder: string) => void): void;
|
|
1091
|
+
export function mkdtemp(prefix: string, callback: (err: NodeJS.ErrnoException | null, folder: string) => void): void;
|
|
780
1092
|
|
|
781
1093
|
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
782
|
-
namespace mkdtemp {
|
|
1094
|
+
export namespace mkdtemp {
|
|
783
1095
|
/**
|
|
784
1096
|
* Asynchronously creates a unique temporary directory.
|
|
785
1097
|
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
|
786
1098
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
787
1099
|
*/
|
|
788
|
-
function __promisify__(prefix: string, options?:
|
|
1100
|
+
function __promisify__(prefix: string, options?: BaseEncodingOptions | BufferEncoding | null): Promise<string>;
|
|
789
1101
|
|
|
790
1102
|
/**
|
|
791
1103
|
* Asynchronously creates a unique temporary directory.
|
|
792
1104
|
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
|
793
1105
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
794
1106
|
*/
|
|
795
|
-
function __promisify__(prefix: string, options:
|
|
1107
|
+
function __promisify__(prefix: string, options: BufferEncodingOption): Promise<Buffer>;
|
|
796
1108
|
|
|
797
1109
|
/**
|
|
798
1110
|
* Asynchronously creates a unique temporary directory.
|
|
799
1111
|
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
|
800
1112
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
801
1113
|
*/
|
|
802
|
-
function __promisify__(prefix: string, options?:
|
|
1114
|
+
function __promisify__(prefix: string, options?: BaseEncodingOptions | string | null): Promise<string | Buffer>;
|
|
803
1115
|
}
|
|
804
1116
|
|
|
805
1117
|
/**
|
|
@@ -807,30 +1119,30 @@ declare module "fs" {
|
|
|
807
1119
|
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
|
808
1120
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
809
1121
|
*/
|
|
810
|
-
function mkdtempSync(prefix: string, options?:
|
|
1122
|
+
export function mkdtempSync(prefix: string, options?: BaseEncodingOptions | BufferEncoding | null): string;
|
|
811
1123
|
|
|
812
1124
|
/**
|
|
813
1125
|
* Synchronously creates a unique temporary directory.
|
|
814
1126
|
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
|
815
1127
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
816
1128
|
*/
|
|
817
|
-
function mkdtempSync(prefix: string, options:
|
|
1129
|
+
export function mkdtempSync(prefix: string, options: BufferEncodingOption): Buffer;
|
|
818
1130
|
|
|
819
1131
|
/**
|
|
820
1132
|
* Synchronously creates a unique temporary directory.
|
|
821
1133
|
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
|
822
1134
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
823
1135
|
*/
|
|
824
|
-
function mkdtempSync(prefix: string, options?:
|
|
1136
|
+
export function mkdtempSync(prefix: string, options?: BaseEncodingOptions | string | null): string | Buffer;
|
|
825
1137
|
|
|
826
1138
|
/**
|
|
827
1139
|
* Asynchronous readdir(3) - read a directory.
|
|
828
1140
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
829
1141
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
830
1142
|
*/
|
|
831
|
-
function readdir(
|
|
1143
|
+
export function readdir(
|
|
832
1144
|
path: PathLike,
|
|
833
|
-
options: { encoding: BufferEncoding | null; withFileTypes?: false } | BufferEncoding | undefined | null,
|
|
1145
|
+
options: { encoding: BufferEncoding | null; withFileTypes?: false | undefined } | BufferEncoding | undefined | null,
|
|
834
1146
|
callback: (err: NodeJS.ErrnoException | null, files: string[]) => void,
|
|
835
1147
|
): void;
|
|
836
1148
|
|
|
@@ -839,16 +1151,20 @@ declare module "fs" {
|
|
|
839
1151
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
840
1152
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
841
1153
|
*/
|
|
842
|
-
function readdir(
|
|
1154
|
+
export function readdir(
|
|
1155
|
+
path: PathLike,
|
|
1156
|
+
options: { encoding: "buffer"; withFileTypes?: false | undefined } | "buffer",
|
|
1157
|
+
callback: (err: NodeJS.ErrnoException | null, files: Buffer[]) => void
|
|
1158
|
+
): void;
|
|
843
1159
|
|
|
844
1160
|
/**
|
|
845
1161
|
* Asynchronous readdir(3) - read a directory.
|
|
846
1162
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
847
1163
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
848
1164
|
*/
|
|
849
|
-
function readdir(
|
|
1165
|
+
export function readdir(
|
|
850
1166
|
path: PathLike,
|
|
851
|
-
options: {
|
|
1167
|
+
options: BaseEncodingOptions & { withFileTypes?: false | undefined } | BufferEncoding | undefined | null,
|
|
852
1168
|
callback: (err: NodeJS.ErrnoException | null, files: string[] | Buffer[]) => void,
|
|
853
1169
|
): void;
|
|
854
1170
|
|
|
@@ -856,44 +1172,44 @@ declare module "fs" {
|
|
|
856
1172
|
* Asynchronous readdir(3) - read a directory.
|
|
857
1173
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
858
1174
|
*/
|
|
859
|
-
function readdir(path: PathLike, callback: (err: NodeJS.ErrnoException | null, files: string[]) => void): void;
|
|
1175
|
+
export function readdir(path: PathLike, callback: (err: NodeJS.ErrnoException | null, files: string[]) => void): void;
|
|
860
1176
|
|
|
861
1177
|
/**
|
|
862
1178
|
* Asynchronous readdir(3) - read a directory.
|
|
863
1179
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
864
1180
|
* @param options If called with `withFileTypes: true` the result data will be an array of Dirent.
|
|
865
1181
|
*/
|
|
866
|
-
function readdir(path: PathLike, options:
|
|
1182
|
+
export function readdir(path: PathLike, options: BaseEncodingOptions & { withFileTypes: true }, callback: (err: NodeJS.ErrnoException | null, files: Dirent[]) => void): void;
|
|
867
1183
|
|
|
868
1184
|
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
869
|
-
namespace readdir {
|
|
1185
|
+
export namespace readdir {
|
|
870
1186
|
/**
|
|
871
1187
|
* Asynchronous readdir(3) - read a directory.
|
|
872
1188
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
873
1189
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
874
1190
|
*/
|
|
875
|
-
function __promisify__(path: PathLike, options?: { encoding: BufferEncoding | null; withFileTypes?: false } | BufferEncoding | null): Promise<string[]>;
|
|
1191
|
+
function __promisify__(path: PathLike, options?: { encoding: BufferEncoding | null; withFileTypes?: false | undefined } | BufferEncoding | null): Promise<string[]>;
|
|
876
1192
|
|
|
877
1193
|
/**
|
|
878
1194
|
* Asynchronous readdir(3) - read a directory.
|
|
879
1195
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
880
1196
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
881
1197
|
*/
|
|
882
|
-
function __promisify__(path: PathLike, options: "buffer" | { encoding: "buffer"; withFileTypes?: false }): Promise<Buffer[]>;
|
|
1198
|
+
function __promisify__(path: PathLike, options: "buffer" | { encoding: "buffer"; withFileTypes?: false | undefined }): Promise<Buffer[]>;
|
|
883
1199
|
|
|
884
1200
|
/**
|
|
885
1201
|
* Asynchronous readdir(3) - read a directory.
|
|
886
1202
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
887
1203
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
888
1204
|
*/
|
|
889
|
-
function __promisify__(path: PathLike, options?: {
|
|
1205
|
+
function __promisify__(path: PathLike, options?: BaseEncodingOptions & { withFileTypes?: false | undefined } | BufferEncoding | null): Promise<string[] | Buffer[]>;
|
|
890
1206
|
|
|
891
1207
|
/**
|
|
892
1208
|
* Asynchronous readdir(3) - read a directory.
|
|
893
1209
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
894
1210
|
* @param options If called with `withFileTypes: true` the result data will be an array of Dirent
|
|
895
1211
|
*/
|
|
896
|
-
function __promisify__(path: PathLike, options:
|
|
1212
|
+
function __promisify__(path: PathLike, options: BaseEncodingOptions & { withFileTypes: true }): Promise<Dirent[]>;
|
|
897
1213
|
}
|
|
898
1214
|
|
|
899
1215
|
/**
|
|
@@ -901,37 +1217,37 @@ declare module "fs" {
|
|
|
901
1217
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
902
1218
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
903
1219
|
*/
|
|
904
|
-
function readdirSync(path: PathLike, options?: { encoding: BufferEncoding | null; withFileTypes?: false } | BufferEncoding | null): string[];
|
|
1220
|
+
export function readdirSync(path: PathLike, options?: { encoding: BufferEncoding | null; withFileTypes?: false | undefined } | BufferEncoding | null): string[];
|
|
905
1221
|
|
|
906
1222
|
/**
|
|
907
1223
|
* Synchronous readdir(3) - read a directory.
|
|
908
1224
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
909
1225
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
910
1226
|
*/
|
|
911
|
-
function readdirSync(path: PathLike, options: { encoding: "buffer"; withFileTypes?: false } | "buffer"): Buffer[];
|
|
1227
|
+
export function readdirSync(path: PathLike, options: { encoding: "buffer"; withFileTypes?: false | undefined } | "buffer"): Buffer[];
|
|
912
1228
|
|
|
913
1229
|
/**
|
|
914
1230
|
* Synchronous readdir(3) - read a directory.
|
|
915
1231
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
916
1232
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
917
1233
|
*/
|
|
918
|
-
function readdirSync(path: PathLike, options?: {
|
|
1234
|
+
export function readdirSync(path: PathLike, options?: BaseEncodingOptions & { withFileTypes?: false | undefined } | BufferEncoding | null): string[] | Buffer[];
|
|
919
1235
|
|
|
920
1236
|
/**
|
|
921
1237
|
* Synchronous readdir(3) - read a directory.
|
|
922
1238
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
923
1239
|
* @param options If called with `withFileTypes: true` the result data will be an array of Dirent.
|
|
924
1240
|
*/
|
|
925
|
-
function readdirSync(path: PathLike, options:
|
|
1241
|
+
export function readdirSync(path: PathLike, options: BaseEncodingOptions & { withFileTypes: true }): Dirent[];
|
|
926
1242
|
|
|
927
1243
|
/**
|
|
928
1244
|
* Asynchronous close(2) - close a file descriptor.
|
|
929
1245
|
* @param fd A file descriptor.
|
|
930
1246
|
*/
|
|
931
|
-
function close(fd: number, callback:
|
|
1247
|
+
export function close(fd: number, callback: NoParamCallback): void;
|
|
932
1248
|
|
|
933
1249
|
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
934
|
-
namespace close {
|
|
1250
|
+
export namespace close {
|
|
935
1251
|
/**
|
|
936
1252
|
* Asynchronous close(2) - close a file descriptor.
|
|
937
1253
|
* @param fd A file descriptor.
|
|
@@ -943,29 +1259,37 @@ declare module "fs" {
|
|
|
943
1259
|
* Synchronous close(2) - close a file descriptor.
|
|
944
1260
|
* @param fd A file descriptor.
|
|
945
1261
|
*/
|
|
946
|
-
function closeSync(fd: number): void;
|
|
1262
|
+
export function closeSync(fd: number): void;
|
|
947
1263
|
|
|
948
1264
|
/**
|
|
949
1265
|
* Asynchronous open(2) - open and possibly create a file.
|
|
950
1266
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
951
|
-
* @param
|
|
1267
|
+
* @param [flags='r'] See `support of file system `flags``.
|
|
1268
|
+
* @param [mode=0o666]
|
|
952
1269
|
*/
|
|
953
|
-
function open(path: PathLike, flags:
|
|
1270
|
+
export function open(path: PathLike, flags: OpenMode | undefined, mode: Mode | undefined | null, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void;
|
|
954
1271
|
|
|
955
1272
|
/**
|
|
956
1273
|
* Asynchronous open(2) - open and possibly create a file. If the file is created, its mode will be `0o666`.
|
|
957
1274
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1275
|
+
* @param [flags='r'] See `support of file system `flags``.
|
|
958
1276
|
*/
|
|
959
|
-
function open(path: PathLike, flags:
|
|
1277
|
+
export function open(path: PathLike, flags: OpenMode | undefined, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void;
|
|
1278
|
+
|
|
1279
|
+
/**
|
|
1280
|
+
* Asynchronous open(2) - open and possibly create a file. If the file is created, its mode will be `0o666`.
|
|
1281
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1282
|
+
*/
|
|
1283
|
+
export function open(path: PathLike, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void;
|
|
960
1284
|
|
|
961
1285
|
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
962
|
-
namespace open {
|
|
1286
|
+
export namespace open {
|
|
963
1287
|
/**
|
|
964
1288
|
* Asynchronous open(2) - open and possibly create a file.
|
|
965
1289
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
966
1290
|
* @param mode A file mode. If a string is passed, it is parsed as an octal integer. If not supplied, defaults to `0o666`.
|
|
967
1291
|
*/
|
|
968
|
-
function __promisify__(path: PathLike, flags:
|
|
1292
|
+
function __promisify__(path: PathLike, flags: OpenMode, mode?: Mode | null): Promise<number>;
|
|
969
1293
|
}
|
|
970
1294
|
|
|
971
1295
|
/**
|
|
@@ -973,7 +1297,7 @@ declare module "fs" {
|
|
|
973
1297
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
974
1298
|
* @param mode A file mode. If a string is passed, it is parsed as an octal integer. If not supplied, defaults to `0o666`.
|
|
975
1299
|
*/
|
|
976
|
-
function openSync(path: PathLike, flags:
|
|
1300
|
+
export function openSync(path: PathLike, flags: OpenMode, mode?: Mode | null): number;
|
|
977
1301
|
|
|
978
1302
|
/**
|
|
979
1303
|
* Asynchronously change file timestamps of the file referenced by the supplied path.
|
|
@@ -981,10 +1305,10 @@ declare module "fs" {
|
|
|
981
1305
|
* @param atime The last access time. If a string is provided, it will be coerced to number.
|
|
982
1306
|
* @param mtime The last modified time. If a string is provided, it will be coerced to number.
|
|
983
1307
|
*/
|
|
984
|
-
function utimes(path: PathLike, atime: string | number | Date, mtime: string | number | Date, callback:
|
|
1308
|
+
export function utimes(path: PathLike, atime: string | number | Date, mtime: string | number | Date, callback: NoParamCallback): void;
|
|
985
1309
|
|
|
986
1310
|
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
987
|
-
namespace utimes {
|
|
1311
|
+
export namespace utimes {
|
|
988
1312
|
/**
|
|
989
1313
|
* Asynchronously change file timestamps of the file referenced by the supplied path.
|
|
990
1314
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -1000,7 +1324,7 @@ declare module "fs" {
|
|
|
1000
1324
|
* @param atime The last access time. If a string is provided, it will be coerced to number.
|
|
1001
1325
|
* @param mtime The last modified time. If a string is provided, it will be coerced to number.
|
|
1002
1326
|
*/
|
|
1003
|
-
function utimesSync(path: PathLike, atime: string | number | Date, mtime: string | number | Date): void;
|
|
1327
|
+
export function utimesSync(path: PathLike, atime: string | number | Date, mtime: string | number | Date): void;
|
|
1004
1328
|
|
|
1005
1329
|
/**
|
|
1006
1330
|
* Asynchronously change file timestamps of the file referenced by the supplied file descriptor.
|
|
@@ -1008,10 +1332,10 @@ declare module "fs" {
|
|
|
1008
1332
|
* @param atime The last access time. If a string is provided, it will be coerced to number.
|
|
1009
1333
|
* @param mtime The last modified time. If a string is provided, it will be coerced to number.
|
|
1010
1334
|
*/
|
|
1011
|
-
function futimes(fd: number, atime: string | number | Date, mtime: string | number | Date, callback:
|
|
1335
|
+
export function futimes(fd: number, atime: string | number | Date, mtime: string | number | Date, callback: NoParamCallback): void;
|
|
1012
1336
|
|
|
1013
1337
|
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
1014
|
-
namespace futimes {
|
|
1338
|
+
export namespace futimes {
|
|
1015
1339
|
/**
|
|
1016
1340
|
* Asynchronously change file timestamps of the file referenced by the supplied file descriptor.
|
|
1017
1341
|
* @param fd A file descriptor.
|
|
@@ -1027,16 +1351,16 @@ declare module "fs" {
|
|
|
1027
1351
|
* @param atime The last access time. If a string is provided, it will be coerced to number.
|
|
1028
1352
|
* @param mtime The last modified time. If a string is provided, it will be coerced to number.
|
|
1029
1353
|
*/
|
|
1030
|
-
function futimesSync(fd: number, atime: string | number | Date, mtime: string | number | Date): void;
|
|
1354
|
+
export function futimesSync(fd: number, atime: string | number | Date, mtime: string | number | Date): void;
|
|
1031
1355
|
|
|
1032
1356
|
/**
|
|
1033
1357
|
* Asynchronous fsync(2) - synchronize a file's in-core state with the underlying storage device.
|
|
1034
1358
|
* @param fd A file descriptor.
|
|
1035
1359
|
*/
|
|
1036
|
-
function fsync(fd: number, callback:
|
|
1360
|
+
export function fsync(fd: number, callback: NoParamCallback): void;
|
|
1037
1361
|
|
|
1038
1362
|
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
1039
|
-
namespace fsync {
|
|
1363
|
+
export namespace fsync {
|
|
1040
1364
|
/**
|
|
1041
1365
|
* Asynchronous fsync(2) - synchronize a file's in-core state with the underlying storage device.
|
|
1042
1366
|
* @param fd A file descriptor.
|
|
@@ -1048,7 +1372,7 @@ declare module "fs" {
|
|
|
1048
1372
|
* Synchronous fsync(2) - synchronize a file's in-core state with the underlying storage device.
|
|
1049
1373
|
* @param fd A file descriptor.
|
|
1050
1374
|
*/
|
|
1051
|
-
function fsyncSync(fd: number): void;
|
|
1375
|
+
export function fsyncSync(fd: number): void;
|
|
1052
1376
|
|
|
1053
1377
|
/**
|
|
1054
1378
|
* Asynchronously writes `buffer` to the file referenced by the supplied file descriptor.
|
|
@@ -1057,7 +1381,7 @@ declare module "fs" {
|
|
|
1057
1381
|
* @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`.
|
|
1058
1382
|
* @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
|
|
1059
1383
|
*/
|
|
1060
|
-
function write<TBuffer extends
|
|
1384
|
+
export function write<TBuffer extends NodeJS.ArrayBufferView>(
|
|
1061
1385
|
fd: number,
|
|
1062
1386
|
buffer: TBuffer,
|
|
1063
1387
|
offset: number | undefined | null,
|
|
@@ -1072,7 +1396,7 @@ declare module "fs" {
|
|
|
1072
1396
|
* @param offset The part of the buffer to be written. If not supplied, defaults to `0`.
|
|
1073
1397
|
* @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`.
|
|
1074
1398
|
*/
|
|
1075
|
-
function write<TBuffer extends
|
|
1399
|
+
export function write<TBuffer extends NodeJS.ArrayBufferView>(
|
|
1076
1400
|
fd: number,
|
|
1077
1401
|
buffer: TBuffer,
|
|
1078
1402
|
offset: number | undefined | null,
|
|
@@ -1085,7 +1409,7 @@ declare module "fs" {
|
|
|
1085
1409
|
* @param fd A file descriptor.
|
|
1086
1410
|
* @param offset The part of the buffer to be written. If not supplied, defaults to `0`.
|
|
1087
1411
|
*/
|
|
1088
|
-
function write<TBuffer extends
|
|
1412
|
+
export function write<TBuffer extends NodeJS.ArrayBufferView>(
|
|
1089
1413
|
fd: number,
|
|
1090
1414
|
buffer: TBuffer,
|
|
1091
1415
|
offset: number | undefined | null,
|
|
@@ -1096,40 +1420,40 @@ declare module "fs" {
|
|
|
1096
1420
|
* Asynchronously writes `buffer` to the file referenced by the supplied file descriptor.
|
|
1097
1421
|
* @param fd A file descriptor.
|
|
1098
1422
|
*/
|
|
1099
|
-
function write<TBuffer extends
|
|
1423
|
+
export function write<TBuffer extends NodeJS.ArrayBufferView>(fd: number, buffer: TBuffer, callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void): void;
|
|
1100
1424
|
|
|
1101
1425
|
/**
|
|
1102
1426
|
* Asynchronously writes `string` to the file referenced by the supplied file descriptor.
|
|
1103
1427
|
* @param fd A file descriptor.
|
|
1104
|
-
* @param string A string to write.
|
|
1428
|
+
* @param string A string to write.
|
|
1105
1429
|
* @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
|
|
1106
1430
|
* @param encoding The expected string encoding.
|
|
1107
1431
|
*/
|
|
1108
|
-
function write(
|
|
1432
|
+
export function write(
|
|
1109
1433
|
fd: number,
|
|
1110
|
-
string:
|
|
1434
|
+
string: string,
|
|
1111
1435
|
position: number | undefined | null,
|
|
1112
|
-
encoding:
|
|
1436
|
+
encoding: BufferEncoding | undefined | null,
|
|
1113
1437
|
callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void,
|
|
1114
1438
|
): void;
|
|
1115
1439
|
|
|
1116
1440
|
/**
|
|
1117
1441
|
* Asynchronously writes `string` to the file referenced by the supplied file descriptor.
|
|
1118
1442
|
* @param fd A file descriptor.
|
|
1119
|
-
* @param string A string to write.
|
|
1443
|
+
* @param string A string to write.
|
|
1120
1444
|
* @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
|
|
1121
1445
|
*/
|
|
1122
|
-
function write(fd: number, string:
|
|
1446
|
+
export function write(fd: number, string: string, position: number | undefined | null, callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void): void;
|
|
1123
1447
|
|
|
1124
1448
|
/**
|
|
1125
1449
|
* Asynchronously writes `string` to the file referenced by the supplied file descriptor.
|
|
1126
1450
|
* @param fd A file descriptor.
|
|
1127
|
-
* @param string A string to write.
|
|
1451
|
+
* @param string A string to write.
|
|
1128
1452
|
*/
|
|
1129
|
-
function write(fd: number, string:
|
|
1453
|
+
export function write(fd: number, string: string, callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void): void;
|
|
1130
1454
|
|
|
1131
1455
|
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
1132
|
-
namespace write {
|
|
1456
|
+
export namespace write {
|
|
1133
1457
|
/**
|
|
1134
1458
|
* Asynchronously writes `buffer` to the file referenced by the supplied file descriptor.
|
|
1135
1459
|
* @param fd A file descriptor.
|
|
@@ -1137,7 +1461,7 @@ declare module "fs" {
|
|
|
1137
1461
|
* @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`.
|
|
1138
1462
|
* @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
|
|
1139
1463
|
*/
|
|
1140
|
-
function __promisify__<TBuffer extends
|
|
1464
|
+
function __promisify__<TBuffer extends NodeJS.ArrayBufferView>(
|
|
1141
1465
|
fd: number,
|
|
1142
1466
|
buffer?: TBuffer,
|
|
1143
1467
|
offset?: number,
|
|
@@ -1148,11 +1472,11 @@ declare module "fs" {
|
|
|
1148
1472
|
/**
|
|
1149
1473
|
* Asynchronously writes `string` to the file referenced by the supplied file descriptor.
|
|
1150
1474
|
* @param fd A file descriptor.
|
|
1151
|
-
* @param string A string to write.
|
|
1475
|
+
* @param string A string to write.
|
|
1152
1476
|
* @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
|
|
1153
1477
|
* @param encoding The expected string encoding.
|
|
1154
1478
|
*/
|
|
1155
|
-
function __promisify__(fd: number, string:
|
|
1479
|
+
function __promisify__(fd: number, string: string, position?: number | null, encoding?: BufferEncoding | null): Promise<{ bytesWritten: number, buffer: string }>;
|
|
1156
1480
|
}
|
|
1157
1481
|
|
|
1158
1482
|
/**
|
|
@@ -1162,16 +1486,16 @@ declare module "fs" {
|
|
|
1162
1486
|
* @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`.
|
|
1163
1487
|
* @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
|
|
1164
1488
|
*/
|
|
1165
|
-
function writeSync(fd: number, buffer:
|
|
1489
|
+
export function writeSync(fd: number, buffer: NodeJS.ArrayBufferView, offset?: number | null, length?: number | null, position?: number | null): number;
|
|
1166
1490
|
|
|
1167
1491
|
/**
|
|
1168
1492
|
* Synchronously writes `string` to the file referenced by the supplied file descriptor, returning the number of bytes written.
|
|
1169
1493
|
* @param fd A file descriptor.
|
|
1170
|
-
* @param string A string to write.
|
|
1494
|
+
* @param string A string to write.
|
|
1171
1495
|
* @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
|
|
1172
1496
|
* @param encoding The expected string encoding.
|
|
1173
1497
|
*/
|
|
1174
|
-
function writeSync(fd: number, string:
|
|
1498
|
+
export function writeSync(fd: number, string: string, position?: number | null, encoding?: BufferEncoding | null): number;
|
|
1175
1499
|
|
|
1176
1500
|
/**
|
|
1177
1501
|
* Asynchronously reads data from the file referenced by the supplied file descriptor.
|
|
@@ -1181,17 +1505,17 @@ declare module "fs" {
|
|
|
1181
1505
|
* @param length The number of bytes to read.
|
|
1182
1506
|
* @param position The offset from the beginning of the file from which data should be read. If `null`, data will be read from the current position.
|
|
1183
1507
|
*/
|
|
1184
|
-
function read<TBuffer extends
|
|
1508
|
+
export function read<TBuffer extends NodeJS.ArrayBufferView>(
|
|
1185
1509
|
fd: number,
|
|
1186
1510
|
buffer: TBuffer,
|
|
1187
1511
|
offset: number,
|
|
1188
1512
|
length: number,
|
|
1189
1513
|
position: number | null,
|
|
1190
|
-
callback
|
|
1514
|
+
callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void,
|
|
1191
1515
|
): void;
|
|
1192
1516
|
|
|
1193
1517
|
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
1194
|
-
namespace read {
|
|
1518
|
+
export namespace read {
|
|
1195
1519
|
/**
|
|
1196
1520
|
* @param fd A file descriptor.
|
|
1197
1521
|
* @param buffer The buffer that the data will be written to.
|
|
@@ -1199,7 +1523,28 @@ declare module "fs" {
|
|
|
1199
1523
|
* @param length The number of bytes to read.
|
|
1200
1524
|
* @param position The offset from the beginning of the file from which data should be read. If `null`, data will be read from the current position.
|
|
1201
1525
|
*/
|
|
1202
|
-
function __promisify__<TBuffer extends
|
|
1526
|
+
function __promisify__<TBuffer extends NodeJS.ArrayBufferView>(
|
|
1527
|
+
fd: number,
|
|
1528
|
+
buffer: TBuffer,
|
|
1529
|
+
offset: number,
|
|
1530
|
+
length: number,
|
|
1531
|
+
position: number | null
|
|
1532
|
+
): Promise<{ bytesRead: number, buffer: TBuffer }>;
|
|
1533
|
+
}
|
|
1534
|
+
|
|
1535
|
+
export interface ReadSyncOptions {
|
|
1536
|
+
/**
|
|
1537
|
+
* @default 0
|
|
1538
|
+
*/
|
|
1539
|
+
offset?: number | undefined;
|
|
1540
|
+
/**
|
|
1541
|
+
* @default `length of buffer`
|
|
1542
|
+
*/
|
|
1543
|
+
length?: number | undefined;
|
|
1544
|
+
/**
|
|
1545
|
+
* @default null
|
|
1546
|
+
*/
|
|
1547
|
+
position?: number | null | undefined;
|
|
1203
1548
|
}
|
|
1204
1549
|
|
|
1205
1550
|
/**
|
|
@@ -1210,7 +1555,13 @@ declare module "fs" {
|
|
|
1210
1555
|
* @param length The number of bytes to read.
|
|
1211
1556
|
* @param position The offset from the beginning of the file from which data should be read. If `null`, data will be read from the current position.
|
|
1212
1557
|
*/
|
|
1213
|
-
function readSync(fd: number, buffer:
|
|
1558
|
+
export function readSync(fd: number, buffer: NodeJS.ArrayBufferView, offset: number, length: number, position: number | null): number;
|
|
1559
|
+
|
|
1560
|
+
/**
|
|
1561
|
+
* Similar to the above `fs.readSync` function, this version takes an optional `options` object.
|
|
1562
|
+
* If no `options` object is specified, it will default with the above values.
|
|
1563
|
+
*/
|
|
1564
|
+
export function readSync(fd: number, buffer: NodeJS.ArrayBufferView, opts?: ReadSyncOptions): number;
|
|
1214
1565
|
|
|
1215
1566
|
/**
|
|
1216
1567
|
* Asynchronously reads the entire contents of a file.
|
|
@@ -1219,7 +1570,11 @@ declare module "fs" {
|
|
|
1219
1570
|
* @param options An object that may contain an optional flag.
|
|
1220
1571
|
* If a flag is not provided, it defaults to `'r'`.
|
|
1221
1572
|
*/
|
|
1222
|
-
function readFile(
|
|
1573
|
+
export function readFile(
|
|
1574
|
+
path: PathLike | number,
|
|
1575
|
+
options: { encoding?: null | undefined; flag?: string | undefined; } | undefined | null,
|
|
1576
|
+
callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void
|
|
1577
|
+
): void;
|
|
1223
1578
|
|
|
1224
1579
|
/**
|
|
1225
1580
|
* Asynchronously reads the entire contents of a file.
|
|
@@ -1229,7 +1584,11 @@ declare module "fs" {
|
|
|
1229
1584
|
* @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
|
|
1230
1585
|
* If a flag is not provided, it defaults to `'r'`.
|
|
1231
1586
|
*/
|
|
1232
|
-
function readFile(
|
|
1587
|
+
export function readFile(
|
|
1588
|
+
path: PathLike | number,
|
|
1589
|
+
options: { encoding: BufferEncoding; flag?: string | undefined; } | BufferEncoding,
|
|
1590
|
+
callback: (err: NodeJS.ErrnoException | null, data: string) => void
|
|
1591
|
+
): void;
|
|
1233
1592
|
|
|
1234
1593
|
/**
|
|
1235
1594
|
* Asynchronously reads the entire contents of a file.
|
|
@@ -1239,9 +1598,9 @@ declare module "fs" {
|
|
|
1239
1598
|
* @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
|
|
1240
1599
|
* If a flag is not provided, it defaults to `'r'`.
|
|
1241
1600
|
*/
|
|
1242
|
-
function readFile(
|
|
1601
|
+
export function readFile(
|
|
1243
1602
|
path: PathLike | number,
|
|
1244
|
-
options: {
|
|
1603
|
+
options: BaseEncodingOptions & { flag?: string | undefined; } | BufferEncoding | undefined | null,
|
|
1245
1604
|
callback: (err: NodeJS.ErrnoException | null, data: string | Buffer) => void,
|
|
1246
1605
|
): void;
|
|
1247
1606
|
|
|
@@ -1250,10 +1609,10 @@ declare module "fs" {
|
|
|
1250
1609
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1251
1610
|
* If a file descriptor is provided, the underlying file will _not_ be closed automatically.
|
|
1252
1611
|
*/
|
|
1253
|
-
function readFile(path: PathLike | number, callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void): void;
|
|
1612
|
+
export function readFile(path: PathLike | number, callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void): void;
|
|
1254
1613
|
|
|
1255
1614
|
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
1256
|
-
namespace readFile {
|
|
1615
|
+
export namespace readFile {
|
|
1257
1616
|
/**
|
|
1258
1617
|
* Asynchronously reads the entire contents of a file.
|
|
1259
1618
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -1261,7 +1620,7 @@ declare module "fs" {
|
|
|
1261
1620
|
* @param options An object that may contain an optional flag.
|
|
1262
1621
|
* If a flag is not provided, it defaults to `'r'`.
|
|
1263
1622
|
*/
|
|
1264
|
-
function __promisify__(path: PathLike | number, options?: { encoding?: null; flag?: string; } | null): Promise<Buffer>;
|
|
1623
|
+
function __promisify__(path: PathLike | number, options?: { encoding?: null | undefined; flag?: string | undefined; } | null): Promise<Buffer>;
|
|
1265
1624
|
|
|
1266
1625
|
/**
|
|
1267
1626
|
* Asynchronously reads the entire contents of a file.
|
|
@@ -1271,7 +1630,7 @@ declare module "fs" {
|
|
|
1271
1630
|
* @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
|
|
1272
1631
|
* If a flag is not provided, it defaults to `'r'`.
|
|
1273
1632
|
*/
|
|
1274
|
-
function __promisify__(path: PathLike | number, options: { encoding:
|
|
1633
|
+
function __promisify__(path: PathLike | number, options: { encoding: BufferEncoding; flag?: string | undefined; } | BufferEncoding): Promise<string>;
|
|
1275
1634
|
|
|
1276
1635
|
/**
|
|
1277
1636
|
* Asynchronously reads the entire contents of a file.
|
|
@@ -1281,7 +1640,7 @@ declare module "fs" {
|
|
|
1281
1640
|
* @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
|
|
1282
1641
|
* If a flag is not provided, it defaults to `'r'`.
|
|
1283
1642
|
*/
|
|
1284
|
-
function __promisify__(path: PathLike | number, options?: {
|
|
1643
|
+
function __promisify__(path: PathLike | number, options?: BaseEncodingOptions & { flag?: string | undefined; } | BufferEncoding | null): Promise<string | Buffer>;
|
|
1285
1644
|
}
|
|
1286
1645
|
|
|
1287
1646
|
/**
|
|
@@ -1291,7 +1650,7 @@ declare module "fs" {
|
|
|
1291
1650
|
* If a file descriptor is provided, the underlying file will _not_ be closed automatically.
|
|
1292
1651
|
* @param options An object that may contain an optional flag. If a flag is not provided, it defaults to `'r'`.
|
|
1293
1652
|
*/
|
|
1294
|
-
function readFileSync(path: PathLike | number, options?: { encoding?: null; flag?: string; } | null): Buffer;
|
|
1653
|
+
export function readFileSync(path: PathLike | number, options?: { encoding?: null | undefined; flag?: string | undefined; } | null): Buffer;
|
|
1295
1654
|
|
|
1296
1655
|
/**
|
|
1297
1656
|
* Synchronously reads the entire contents of a file.
|
|
@@ -1301,7 +1660,7 @@ declare module "fs" {
|
|
|
1301
1660
|
* @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
|
|
1302
1661
|
* If a flag is not provided, it defaults to `'r'`.
|
|
1303
1662
|
*/
|
|
1304
|
-
function readFileSync(path: PathLike | number, options: { encoding:
|
|
1663
|
+
export function readFileSync(path: PathLike | number, options: { encoding: BufferEncoding; flag?: string | undefined; } | BufferEncoding): string;
|
|
1305
1664
|
|
|
1306
1665
|
/**
|
|
1307
1666
|
* Synchronously reads the entire contents of a file.
|
|
@@ -1311,9 +1670,9 @@ declare module "fs" {
|
|
|
1311
1670
|
* @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
|
|
1312
1671
|
* If a flag is not provided, it defaults to `'r'`.
|
|
1313
1672
|
*/
|
|
1314
|
-
function readFileSync(path: PathLike | number, options?: {
|
|
1673
|
+
export function readFileSync(path: PathLike | number, options?: BaseEncodingOptions & { flag?: string | undefined; } | BufferEncoding | null): string | Buffer;
|
|
1315
1674
|
|
|
1316
|
-
type WriteFileOptions =
|
|
1675
|
+
export type WriteFileOptions = BaseEncodingOptions & { mode?: Mode | undefined; flag?: string | undefined; } | BufferEncoding | null;
|
|
1317
1676
|
|
|
1318
1677
|
/**
|
|
1319
1678
|
* Asynchronously writes data to a file, replacing the file if it already exists.
|
|
@@ -1327,7 +1686,7 @@ declare module "fs" {
|
|
|
1327
1686
|
* If `mode` is a string, it is parsed as an octal integer.
|
|
1328
1687
|
* If `flag` is not supplied, the default of `'w'` is used.
|
|
1329
1688
|
*/
|
|
1330
|
-
function writeFile(path: PathLike | number, data:
|
|
1689
|
+
export function writeFile(path: PathLike | number, data: string | NodeJS.ArrayBufferView, options: WriteFileOptions, callback: NoParamCallback): void;
|
|
1331
1690
|
|
|
1332
1691
|
/**
|
|
1333
1692
|
* Asynchronously writes data to a file, replacing the file if it already exists.
|
|
@@ -1336,10 +1695,10 @@ declare module "fs" {
|
|
|
1336
1695
|
* If a file descriptor is provided, the underlying file will _not_ be closed automatically.
|
|
1337
1696
|
* @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
|
|
1338
1697
|
*/
|
|
1339
|
-
function writeFile(path: PathLike | number, data:
|
|
1698
|
+
export function writeFile(path: PathLike | number, data: string | NodeJS.ArrayBufferView, callback: NoParamCallback): void;
|
|
1340
1699
|
|
|
1341
1700
|
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
1342
|
-
namespace writeFile {
|
|
1701
|
+
export namespace writeFile {
|
|
1343
1702
|
/**
|
|
1344
1703
|
* Asynchronously writes data to a file, replacing the file if it already exists.
|
|
1345
1704
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -1352,7 +1711,7 @@ declare module "fs" {
|
|
|
1352
1711
|
* If `mode` is a string, it is parsed as an octal integer.
|
|
1353
1712
|
* If `flag` is not supplied, the default of `'w'` is used.
|
|
1354
1713
|
*/
|
|
1355
|
-
function __promisify__(path: PathLike | number, data:
|
|
1714
|
+
function __promisify__(path: PathLike | number, data: string | NodeJS.ArrayBufferView, options?: WriteFileOptions): Promise<void>;
|
|
1356
1715
|
}
|
|
1357
1716
|
|
|
1358
1717
|
/**
|
|
@@ -1367,7 +1726,7 @@ declare module "fs" {
|
|
|
1367
1726
|
* If `mode` is a string, it is parsed as an octal integer.
|
|
1368
1727
|
* If `flag` is not supplied, the default of `'w'` is used.
|
|
1369
1728
|
*/
|
|
1370
|
-
function writeFileSync(path: PathLike | number, data:
|
|
1729
|
+
export function writeFileSync(path: PathLike | number, data: string | NodeJS.ArrayBufferView, options?: WriteFileOptions): void;
|
|
1371
1730
|
|
|
1372
1731
|
/**
|
|
1373
1732
|
* Asynchronously append data to a file, creating the file if it does not exist.
|
|
@@ -1381,7 +1740,7 @@ declare module "fs" {
|
|
|
1381
1740
|
* If `mode` is a string, it is parsed as an octal integer.
|
|
1382
1741
|
* If `flag` is not supplied, the default of `'a'` is used.
|
|
1383
1742
|
*/
|
|
1384
|
-
function appendFile(file: PathLike | number, data:
|
|
1743
|
+
export function appendFile(file: PathLike | number, data: string | Uint8Array, options: WriteFileOptions, callback: NoParamCallback): void;
|
|
1385
1744
|
|
|
1386
1745
|
/**
|
|
1387
1746
|
* Asynchronously append data to a file, creating the file if it does not exist.
|
|
@@ -1390,10 +1749,10 @@ declare module "fs" {
|
|
|
1390
1749
|
* If a file descriptor is provided, the underlying file will _not_ be closed automatically.
|
|
1391
1750
|
* @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
|
|
1392
1751
|
*/
|
|
1393
|
-
function appendFile(file: PathLike | number, data:
|
|
1752
|
+
export function appendFile(file: PathLike | number, data: string | Uint8Array, callback: NoParamCallback): void;
|
|
1394
1753
|
|
|
1395
1754
|
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
1396
|
-
namespace appendFile {
|
|
1755
|
+
export namespace appendFile {
|
|
1397
1756
|
/**
|
|
1398
1757
|
* Asynchronously append data to a file, creating the file if it does not exist.
|
|
1399
1758
|
* @param file A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -1406,7 +1765,7 @@ declare module "fs" {
|
|
|
1406
1765
|
* If `mode` is a string, it is parsed as an octal integer.
|
|
1407
1766
|
* If `flag` is not supplied, the default of `'a'` is used.
|
|
1408
1767
|
*/
|
|
1409
|
-
function __promisify__(file: PathLike | number, data:
|
|
1768
|
+
function __promisify__(file: PathLike | number, data: string | Uint8Array, options?: WriteFileOptions): Promise<void>;
|
|
1410
1769
|
}
|
|
1411
1770
|
|
|
1412
1771
|
/**
|
|
@@ -1421,26 +1780,26 @@ declare module "fs" {
|
|
|
1421
1780
|
* If `mode` is a string, it is parsed as an octal integer.
|
|
1422
1781
|
* If `flag` is not supplied, the default of `'a'` is used.
|
|
1423
1782
|
*/
|
|
1424
|
-
function appendFileSync(file: PathLike | number, data:
|
|
1783
|
+
export function appendFileSync(file: PathLike | number, data: string | Uint8Array, options?: WriteFileOptions): void;
|
|
1425
1784
|
|
|
1426
1785
|
/**
|
|
1427
1786
|
* Watch for changes on `filename`. The callback `listener` will be called each time the file is accessed.
|
|
1428
1787
|
*/
|
|
1429
|
-
function watchFile(filename: PathLike, options: { persistent?: boolean; interval?: number; } | undefined, listener: (curr: Stats, prev: Stats) => void): void;
|
|
1788
|
+
export function watchFile(filename: PathLike, options: { persistent?: boolean | undefined; interval?: number | undefined; } | undefined, listener: (curr: Stats, prev: Stats) => void): void;
|
|
1430
1789
|
|
|
1431
1790
|
/**
|
|
1432
1791
|
* Watch for changes on `filename`. The callback `listener` will be called each time the file is accessed.
|
|
1433
1792
|
* @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
|
|
1434
1793
|
* URL support is _experimental_.
|
|
1435
1794
|
*/
|
|
1436
|
-
function watchFile(filename: PathLike, listener: (curr: Stats, prev: Stats) => void): void;
|
|
1795
|
+
export function watchFile(filename: PathLike, listener: (curr: Stats, prev: Stats) => void): void;
|
|
1437
1796
|
|
|
1438
1797
|
/**
|
|
1439
1798
|
* Stop watching for changes on `filename`.
|
|
1440
1799
|
* @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
|
|
1441
1800
|
* URL support is _experimental_.
|
|
1442
1801
|
*/
|
|
1443
|
-
function unwatchFile(filename: PathLike, listener?: (curr: Stats, prev: Stats) => void): void;
|
|
1802
|
+
export function unwatchFile(filename: PathLike, listener?: (curr: Stats, prev: Stats) => void): void;
|
|
1444
1803
|
|
|
1445
1804
|
/**
|
|
1446
1805
|
* Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
|
|
@@ -1451,10 +1810,10 @@ declare module "fs" {
|
|
|
1451
1810
|
* If `persistent` is not supplied, the default of `true` is used.
|
|
1452
1811
|
* If `recursive` is not supplied, the default of `false` is used.
|
|
1453
1812
|
*/
|
|
1454
|
-
function watch(
|
|
1813
|
+
export function watch(
|
|
1455
1814
|
filename: PathLike,
|
|
1456
|
-
options: { encoding?: BufferEncoding | null, persistent?: boolean, recursive?: boolean } | BufferEncoding | undefined | null,
|
|
1457
|
-
listener?: (event:
|
|
1815
|
+
options: { encoding?: BufferEncoding | null | undefined, persistent?: boolean | undefined, recursive?: boolean | undefined } | BufferEncoding | undefined | null,
|
|
1816
|
+
listener?: (event: "rename" | "change", filename: string) => void,
|
|
1458
1817
|
): FSWatcher;
|
|
1459
1818
|
|
|
1460
1819
|
/**
|
|
@@ -1466,7 +1825,11 @@ declare module "fs" {
|
|
|
1466
1825
|
* If `persistent` is not supplied, the default of `true` is used.
|
|
1467
1826
|
* If `recursive` is not supplied, the default of `false` is used.
|
|
1468
1827
|
*/
|
|
1469
|
-
function watch(
|
|
1828
|
+
export function watch(
|
|
1829
|
+
filename: PathLike,
|
|
1830
|
+
options: { encoding: "buffer", persistent?: boolean | undefined, recursive?: boolean | undefined; } | "buffer",
|
|
1831
|
+
listener?: (event: "rename" | "change", filename: Buffer) => void
|
|
1832
|
+
): FSWatcher;
|
|
1470
1833
|
|
|
1471
1834
|
/**
|
|
1472
1835
|
* Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
|
|
@@ -1477,10 +1840,10 @@ declare module "fs" {
|
|
|
1477
1840
|
* If `persistent` is not supplied, the default of `true` is used.
|
|
1478
1841
|
* If `recursive` is not supplied, the default of `false` is used.
|
|
1479
1842
|
*/
|
|
1480
|
-
function watch(
|
|
1843
|
+
export function watch(
|
|
1481
1844
|
filename: PathLike,
|
|
1482
|
-
options: { encoding?:
|
|
1483
|
-
listener?: (event:
|
|
1845
|
+
options: { encoding?: BufferEncoding | null | undefined, persistent?: boolean | undefined, recursive?: boolean | undefined } | string | null,
|
|
1846
|
+
listener?: (event: "rename" | "change", filename: string | Buffer) => void,
|
|
1484
1847
|
): FSWatcher;
|
|
1485
1848
|
|
|
1486
1849
|
/**
|
|
@@ -1488,18 +1851,18 @@ declare module "fs" {
|
|
|
1488
1851
|
* @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
|
|
1489
1852
|
* URL support is _experimental_.
|
|
1490
1853
|
*/
|
|
1491
|
-
function watch(filename: PathLike, listener?: (event:
|
|
1854
|
+
export function watch(filename: PathLike, listener?: (event: "rename" | "change", filename: string) => any): FSWatcher;
|
|
1492
1855
|
|
|
1493
1856
|
/**
|
|
1494
1857
|
* Asynchronously tests whether or not the given path exists by checking with the file system.
|
|
1495
|
-
* @deprecated
|
|
1858
|
+
* @deprecated since v1.0.0 Use `fs.stat()` or `fs.access()` instead
|
|
1496
1859
|
* @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
|
|
1497
1860
|
* URL support is _experimental_.
|
|
1498
1861
|
*/
|
|
1499
|
-
function exists(path: PathLike, callback: (exists: boolean) => void): void;
|
|
1862
|
+
export function exists(path: PathLike, callback: (exists: boolean) => void): void;
|
|
1500
1863
|
|
|
1501
1864
|
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
1502
|
-
namespace exists {
|
|
1865
|
+
export namespace exists {
|
|
1503
1866
|
/**
|
|
1504
1867
|
* @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
|
|
1505
1868
|
* URL support is _experimental_.
|
|
@@ -1512,9 +1875,9 @@ declare module "fs" {
|
|
|
1512
1875
|
* @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
|
|
1513
1876
|
* URL support is _experimental_.
|
|
1514
1877
|
*/
|
|
1515
|
-
function existsSync(path: PathLike): boolean;
|
|
1878
|
+
export function existsSync(path: PathLike): boolean;
|
|
1516
1879
|
|
|
1517
|
-
namespace constants {
|
|
1880
|
+
export namespace constants {
|
|
1518
1881
|
// File Access Constants
|
|
1519
1882
|
|
|
1520
1883
|
/** Constant for fs.access(). File is visible to the calling process. */
|
|
@@ -1668,6 +2031,13 @@ declare module "fs" {
|
|
|
1668
2031
|
|
|
1669
2032
|
/** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating executable by others. */
|
|
1670
2033
|
const S_IXOTH: number;
|
|
2034
|
+
|
|
2035
|
+
/**
|
|
2036
|
+
* When set, a memory file mapping is used to access the file. This flag
|
|
2037
|
+
* is available on Windows operating systems only. On other operating systems,
|
|
2038
|
+
* this flag is ignored.
|
|
2039
|
+
*/
|
|
2040
|
+
const UV_FS_O_FILEMAP: number;
|
|
1671
2041
|
}
|
|
1672
2042
|
|
|
1673
2043
|
/**
|
|
@@ -1675,17 +2045,17 @@ declare module "fs" {
|
|
|
1675
2045
|
* @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
|
|
1676
2046
|
* URL support is _experimental_.
|
|
1677
2047
|
*/
|
|
1678
|
-
function access(path: PathLike, mode: number | undefined, callback:
|
|
2048
|
+
export function access(path: PathLike, mode: number | undefined, callback: NoParamCallback): void;
|
|
1679
2049
|
|
|
1680
2050
|
/**
|
|
1681
2051
|
* Asynchronously tests a user's permissions for the file specified by path.
|
|
1682
2052
|
* @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
|
|
1683
2053
|
* URL support is _experimental_.
|
|
1684
2054
|
*/
|
|
1685
|
-
function access(path: PathLike, callback:
|
|
2055
|
+
export function access(path: PathLike, callback: NoParamCallback): void;
|
|
1686
2056
|
|
|
1687
2057
|
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
1688
|
-
namespace access {
|
|
2058
|
+
export namespace access {
|
|
1689
2059
|
/**
|
|
1690
2060
|
* Asynchronously tests a user's permissions for the file specified by path.
|
|
1691
2061
|
* @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -1699,22 +2069,26 @@ declare module "fs" {
|
|
|
1699
2069
|
* @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
|
|
1700
2070
|
* URL support is _experimental_.
|
|
1701
2071
|
*/
|
|
1702
|
-
function accessSync(path: PathLike, mode?: number): void;
|
|
2072
|
+
export function accessSync(path: PathLike, mode?: number): void;
|
|
1703
2073
|
|
|
1704
2074
|
/**
|
|
1705
2075
|
* Returns a new `ReadStream` object.
|
|
1706
2076
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1707
2077
|
* URL support is _experimental_.
|
|
1708
2078
|
*/
|
|
1709
|
-
function createReadStream(path: PathLike, options?:
|
|
1710
|
-
flags?: string;
|
|
1711
|
-
encoding?:
|
|
1712
|
-
fd?: number;
|
|
1713
|
-
mode?: number;
|
|
1714
|
-
autoClose?: boolean;
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
2079
|
+
export function createReadStream(path: PathLike, options?: BufferEncoding | {
|
|
2080
|
+
flags?: string | undefined;
|
|
2081
|
+
encoding?: BufferEncoding | undefined;
|
|
2082
|
+
fd?: number | undefined;
|
|
2083
|
+
mode?: number | undefined;
|
|
2084
|
+
autoClose?: boolean | undefined;
|
|
2085
|
+
/**
|
|
2086
|
+
* @default false
|
|
2087
|
+
*/
|
|
2088
|
+
emitClose?: boolean | undefined;
|
|
2089
|
+
start?: number | undefined;
|
|
2090
|
+
end?: number | undefined;
|
|
2091
|
+
highWaterMark?: number | undefined;
|
|
1718
2092
|
}): ReadStream;
|
|
1719
2093
|
|
|
1720
2094
|
/**
|
|
@@ -1722,24 +2096,25 @@ declare module "fs" {
|
|
|
1722
2096
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1723
2097
|
* URL support is _experimental_.
|
|
1724
2098
|
*/
|
|
1725
|
-
function createWriteStream(path: PathLike, options?:
|
|
1726
|
-
flags?: string;
|
|
1727
|
-
encoding?:
|
|
1728
|
-
fd?: number;
|
|
1729
|
-
mode?: number;
|
|
1730
|
-
autoClose?: boolean;
|
|
1731
|
-
|
|
1732
|
-
|
|
2099
|
+
export function createWriteStream(path: PathLike, options?: BufferEncoding | {
|
|
2100
|
+
flags?: string | undefined;
|
|
2101
|
+
encoding?: BufferEncoding | undefined;
|
|
2102
|
+
fd?: number | undefined;
|
|
2103
|
+
mode?: number | undefined;
|
|
2104
|
+
autoClose?: boolean | undefined;
|
|
2105
|
+
emitClose?: boolean | undefined;
|
|
2106
|
+
start?: number | undefined;
|
|
2107
|
+
highWaterMark?: number | undefined;
|
|
1733
2108
|
}): WriteStream;
|
|
1734
2109
|
|
|
1735
2110
|
/**
|
|
1736
2111
|
* Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device.
|
|
1737
2112
|
* @param fd A file descriptor.
|
|
1738
2113
|
*/
|
|
1739
|
-
function fdatasync(fd: number, callback:
|
|
2114
|
+
export function fdatasync(fd: number, callback: NoParamCallback): void;
|
|
1740
2115
|
|
|
1741
2116
|
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
1742
|
-
namespace fdatasync {
|
|
2117
|
+
export namespace fdatasync {
|
|
1743
2118
|
/**
|
|
1744
2119
|
* Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device.
|
|
1745
2120
|
* @param fd A file descriptor.
|
|
@@ -1751,7 +2126,7 @@ declare module "fs" {
|
|
|
1751
2126
|
* Synchronous fdatasync(2) - synchronize a file's in-core state with storage device.
|
|
1752
2127
|
* @param fd A file descriptor.
|
|
1753
2128
|
*/
|
|
1754
|
-
function fdatasyncSync(fd: number): void;
|
|
2129
|
+
export function fdatasyncSync(fd: number): void;
|
|
1755
2130
|
|
|
1756
2131
|
/**
|
|
1757
2132
|
* Asynchronously copies src to dest. By default, dest is overwritten if it already exists.
|
|
@@ -1762,7 +2137,7 @@ declare module "fs" {
|
|
|
1762
2137
|
* @param src A path to the source file.
|
|
1763
2138
|
* @param dest A path to the destination file.
|
|
1764
2139
|
*/
|
|
1765
|
-
function copyFile(src: PathLike, dest: PathLike, callback:
|
|
2140
|
+
export function copyFile(src: PathLike, dest: PathLike, callback: NoParamCallback): void;
|
|
1766
2141
|
/**
|
|
1767
2142
|
* Asynchronously copies src to dest. By default, dest is overwritten if it already exists.
|
|
1768
2143
|
* No arguments other than a possible exception are given to the callback function.
|
|
@@ -1773,10 +2148,10 @@ declare module "fs" {
|
|
|
1773
2148
|
* @param dest A path to the destination file.
|
|
1774
2149
|
* @param flags An integer that specifies the behavior of the copy operation. The only supported flag is fs.constants.COPYFILE_EXCL, which causes the copy operation to fail if dest already exists.
|
|
1775
2150
|
*/
|
|
1776
|
-
function copyFile(src: PathLike, dest: PathLike, flags: number, callback:
|
|
2151
|
+
export function copyFile(src: PathLike, dest: PathLike, flags: number, callback: NoParamCallback): void;
|
|
1777
2152
|
|
|
1778
2153
|
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
1779
|
-
namespace copyFile {
|
|
2154
|
+
export namespace copyFile {
|
|
1780
2155
|
/**
|
|
1781
2156
|
* Asynchronously copies src to dest. By default, dest is overwritten if it already exists.
|
|
1782
2157
|
* No arguments other than a possible exception are given to the callback function.
|
|
@@ -1802,501 +2177,105 @@ declare module "fs" {
|
|
|
1802
2177
|
* @param flags An optional integer that specifies the behavior of the copy operation.
|
|
1803
2178
|
* The only supported flag is fs.constants.COPYFILE_EXCL, which causes the copy operation to fail if dest already exists.
|
|
1804
2179
|
*/
|
|
1805
|
-
function copyFileSync(src: PathLike, dest: PathLike, flags?: number): void;
|
|
1806
|
-
|
|
1807
|
-
namespace promises {
|
|
1808
|
-
interface FileHandle {
|
|
1809
|
-
/**
|
|
1810
|
-
* Gets the file descriptor for this file handle.
|
|
1811
|
-
*/
|
|
1812
|
-
readonly fd: number;
|
|
1813
|
-
|
|
1814
|
-
/**
|
|
1815
|
-
* Asynchronously append data to a file, creating the file if it does not exist. The underlying file will _not_ be closed automatically.
|
|
1816
|
-
* The `FileHandle` must have been opened for appending.
|
|
1817
|
-
* @param data The data to write. If something other than a `Buffer` or `Uint8Array` is provided, the value is coerced to a string.
|
|
1818
|
-
* @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag.
|
|
1819
|
-
* If `encoding` is not supplied, the default of `'utf8'` is used.
|
|
1820
|
-
* If `mode` is not supplied, the default of `0o666` is used.
|
|
1821
|
-
* If `mode` is a string, it is parsed as an octal integer.
|
|
1822
|
-
* If `flag` is not supplied, the default of `'a'` is used.
|
|
1823
|
-
*/
|
|
1824
|
-
appendFile(data: any, options?: { encoding?: string | null, mode?: string | number, flag?: string | number } | string | null): Promise<void>;
|
|
1825
|
-
|
|
1826
|
-
/**
|
|
1827
|
-
* Asynchronous fchown(2) - Change ownership of a file.
|
|
1828
|
-
*/
|
|
1829
|
-
chown(uid: number, gid: number): Promise<void>;
|
|
1830
|
-
|
|
1831
|
-
/**
|
|
1832
|
-
* Asynchronous fchmod(2) - Change permissions of a file.
|
|
1833
|
-
* @param mode A file mode. If a string is passed, it is parsed as an octal integer.
|
|
1834
|
-
*/
|
|
1835
|
-
chmod(mode: string | number): Promise<void>;
|
|
1836
|
-
|
|
1837
|
-
/**
|
|
1838
|
-
* Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device.
|
|
1839
|
-
*/
|
|
1840
|
-
datasync(): Promise<void>;
|
|
1841
|
-
|
|
1842
|
-
/**
|
|
1843
|
-
* Asynchronous fsync(2) - synchronize a file's in-core state with the underlying storage device.
|
|
1844
|
-
*/
|
|
1845
|
-
sync(): Promise<void>;
|
|
1846
|
-
|
|
1847
|
-
/**
|
|
1848
|
-
* Asynchronously reads data from the file.
|
|
1849
|
-
* The `FileHandle` must have been opened for reading.
|
|
1850
|
-
* @param buffer The buffer that the data will be written to.
|
|
1851
|
-
* @param offset The offset in the buffer at which to start writing.
|
|
1852
|
-
* @param length The number of bytes to read.
|
|
1853
|
-
* @param position The offset from the beginning of the file from which data should be read. If `null`, data will be read from the current position.
|
|
1854
|
-
*/
|
|
1855
|
-
read<TBuffer extends Buffer | Uint8Array>(buffer: TBuffer, offset?: number | null, length?: number | null, position?: number | null): Promise<{ bytesRead: number, buffer: TBuffer }>;
|
|
1856
|
-
|
|
1857
|
-
/**
|
|
1858
|
-
* Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically.
|
|
1859
|
-
* The `FileHandle` must have been opened for reading.
|
|
1860
|
-
* @param options An object that may contain an optional flag.
|
|
1861
|
-
* If a flag is not provided, it defaults to `'r'`.
|
|
1862
|
-
*/
|
|
1863
|
-
readFile(options?: { encoding?: null, flag?: string | number } | null): Promise<Buffer>;
|
|
1864
|
-
|
|
1865
|
-
/**
|
|
1866
|
-
* Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically.
|
|
1867
|
-
* The `FileHandle` must have been opened for reading.
|
|
1868
|
-
* @param options An object that may contain an optional flag.
|
|
1869
|
-
* If a flag is not provided, it defaults to `'r'`.
|
|
1870
|
-
*/
|
|
1871
|
-
readFile(options: { encoding: BufferEncoding, flag?: string | number } | BufferEncoding): Promise<string>;
|
|
1872
|
-
|
|
1873
|
-
/**
|
|
1874
|
-
* Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically.
|
|
1875
|
-
* The `FileHandle` must have been opened for reading.
|
|
1876
|
-
* @param options An object that may contain an optional flag.
|
|
1877
|
-
* If a flag is not provided, it defaults to `'r'`.
|
|
1878
|
-
*/
|
|
1879
|
-
readFile(options?: { encoding?: string | null, flag?: string | number } | string | null): Promise<string | Buffer>;
|
|
1880
|
-
|
|
1881
|
-
/**
|
|
1882
|
-
* Asynchronous fstat(2) - Get file status.
|
|
1883
|
-
*/
|
|
1884
|
-
stat(): Promise<Stats>;
|
|
1885
|
-
|
|
1886
|
-
/**
|
|
1887
|
-
* Asynchronous ftruncate(2) - Truncate a file to a specified length.
|
|
1888
|
-
* @param len If not specified, defaults to `0`.
|
|
1889
|
-
*/
|
|
1890
|
-
truncate(len?: number): Promise<void>;
|
|
1891
|
-
|
|
1892
|
-
/**
|
|
1893
|
-
* Asynchronously change file timestamps of the file.
|
|
1894
|
-
* @param atime The last access time. If a string is provided, it will be coerced to number.
|
|
1895
|
-
* @param mtime The last modified time. If a string is provided, it will be coerced to number.
|
|
1896
|
-
*/
|
|
1897
|
-
utimes(atime: string | number | Date, mtime: string | number | Date): Promise<void>;
|
|
1898
|
-
|
|
1899
|
-
/**
|
|
1900
|
-
* Asynchronously writes `buffer` to the file.
|
|
1901
|
-
* The `FileHandle` must have been opened for writing.
|
|
1902
|
-
* @param buffer The buffer that the data will be written to.
|
|
1903
|
-
* @param offset The part of the buffer to be written. If not supplied, defaults to `0`.
|
|
1904
|
-
* @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`.
|
|
1905
|
-
* @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
|
|
1906
|
-
*/
|
|
1907
|
-
write<TBuffer extends Buffer | Uint8Array>(buffer: TBuffer, offset?: number | null, length?: number | null, position?: number | null): Promise<{ bytesWritten: number, buffer: TBuffer }>;
|
|
1908
|
-
|
|
1909
|
-
/**
|
|
1910
|
-
* Asynchronously writes `string` to the file.
|
|
1911
|
-
* The `FileHandle` must have been opened for writing.
|
|
1912
|
-
* It is unsafe to call `write()` multiple times on the same file without waiting for the `Promise`
|
|
1913
|
-
* to be resolved (or rejected). For this scenario, `fs.createWriteStream` is strongly recommended.
|
|
1914
|
-
* @param string A string to write. If something other than a string is supplied it will be coerced to a string.
|
|
1915
|
-
* @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
|
|
1916
|
-
* @param encoding The expected string encoding.
|
|
1917
|
-
*/
|
|
1918
|
-
write(data: any, position?: number | null, encoding?: string | null): Promise<{ bytesWritten: number, buffer: string }>;
|
|
1919
|
-
|
|
1920
|
-
/**
|
|
1921
|
-
* Asynchronously writes data to a file, replacing the file if it already exists. The underlying file will _not_ be closed automatically.
|
|
1922
|
-
* The `FileHandle` must have been opened for writing.
|
|
1923
|
-
* It is unsafe to call `writeFile()` multiple times on the same file without waiting for the `Promise` to be resolved (or rejected).
|
|
1924
|
-
* @param data The data to write. If something other than a `Buffer` or `Uint8Array` is provided, the value is coerced to a string.
|
|
1925
|
-
* @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag.
|
|
1926
|
-
* If `encoding` is not supplied, the default of `'utf8'` is used.
|
|
1927
|
-
* If `mode` is not supplied, the default of `0o666` is used.
|
|
1928
|
-
* If `mode` is a string, it is parsed as an octal integer.
|
|
1929
|
-
* If `flag` is not supplied, the default of `'w'` is used.
|
|
1930
|
-
*/
|
|
1931
|
-
writeFile(data: any, options?: { encoding?: string | null, mode?: string | number, flag?: string | number } | string | null): Promise<void>;
|
|
1932
|
-
|
|
1933
|
-
/**
|
|
1934
|
-
* Asynchronous close(2) - close a `FileHandle`.
|
|
1935
|
-
*/
|
|
1936
|
-
close(): Promise<void>;
|
|
1937
|
-
}
|
|
1938
|
-
|
|
1939
|
-
/**
|
|
1940
|
-
* Asynchronously tests a user's permissions for the file specified by path.
|
|
1941
|
-
* @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
|
|
1942
|
-
* URL support is _experimental_.
|
|
1943
|
-
*/
|
|
1944
|
-
function access(path: PathLike, mode?: number): Promise<void>;
|
|
2180
|
+
export function copyFileSync(src: PathLike, dest: PathLike, flags?: number): void;
|
|
1945
2181
|
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
*/
|
|
1965
|
-
function open(path: PathLike, flags: string | number, mode?: string | number): Promise<FileHandle>;
|
|
1966
|
-
|
|
1967
|
-
/**
|
|
1968
|
-
* Asynchronously reads data from the file referenced by the supplied `FileHandle`.
|
|
1969
|
-
* @param handle A `FileHandle`.
|
|
1970
|
-
* @param buffer The buffer that the data will be written to.
|
|
1971
|
-
* @param offset The offset in the buffer at which to start writing.
|
|
1972
|
-
* @param length The number of bytes to read.
|
|
1973
|
-
* @param position The offset from the beginning of the file from which data should be read. If
|
|
1974
|
-
* `null`, data will be read from the current position.
|
|
1975
|
-
*/
|
|
1976
|
-
function read<TBuffer extends Buffer | Uint8Array>(
|
|
1977
|
-
handle: FileHandle,
|
|
1978
|
-
buffer: TBuffer,
|
|
1979
|
-
offset?: number | null,
|
|
1980
|
-
length?: number | null,
|
|
1981
|
-
position?: number | null,
|
|
1982
|
-
): Promise<{ bytesRead: number, buffer: TBuffer }>;
|
|
1983
|
-
|
|
1984
|
-
/**
|
|
1985
|
-
* Asynchronously writes `buffer` to the file referenced by the supplied `FileHandle`.
|
|
1986
|
-
* It is unsafe to call `fsPromises.write()` multiple times on the same file without waiting for the `Promise`
|
|
1987
|
-
* to be resolved (or rejected). For this scenario, `fs.createWriteStream` is strongly recommended.
|
|
1988
|
-
* @param handle A `FileHandle`.
|
|
1989
|
-
* @param buffer The buffer that the data will be written to.
|
|
1990
|
-
* @param offset The part of the buffer to be written. If not supplied, defaults to `0`.
|
|
1991
|
-
* @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`.
|
|
1992
|
-
* @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
|
|
1993
|
-
*/
|
|
1994
|
-
function write<TBuffer extends Buffer | Uint8Array>(
|
|
1995
|
-
handle: FileHandle,
|
|
1996
|
-
buffer: TBuffer,
|
|
1997
|
-
offset?: number | null,
|
|
1998
|
-
length?: number | null, position?: number | null): Promise<{ bytesWritten: number, buffer: TBuffer }>;
|
|
1999
|
-
|
|
2000
|
-
/**
|
|
2001
|
-
* Asynchronously writes `string` to the file referenced by the supplied `FileHandle`.
|
|
2002
|
-
* It is unsafe to call `fsPromises.write()` multiple times on the same file without waiting for the `Promise`
|
|
2003
|
-
* to be resolved (or rejected). For this scenario, `fs.createWriteStream` is strongly recommended.
|
|
2004
|
-
* @param handle A `FileHandle`.
|
|
2005
|
-
* @param string A string to write. If something other than a string is supplied it will be coerced to a string.
|
|
2006
|
-
* @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
|
|
2007
|
-
* @param encoding The expected string encoding.
|
|
2008
|
-
*/
|
|
2009
|
-
function write(handle: FileHandle, string: any, position?: number | null, encoding?: string | null): Promise<{ bytesWritten: number, buffer: string }>;
|
|
2010
|
-
|
|
2011
|
-
/**
|
|
2012
|
-
* Asynchronous rename(2) - Change the name or location of a file or directory.
|
|
2013
|
-
* @param oldPath A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2014
|
-
* URL support is _experimental_.
|
|
2015
|
-
* @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2016
|
-
* URL support is _experimental_.
|
|
2017
|
-
*/
|
|
2018
|
-
function rename(oldPath: PathLike, newPath: PathLike): Promise<void>;
|
|
2019
|
-
|
|
2020
|
-
/**
|
|
2021
|
-
* Asynchronous truncate(2) - Truncate a file to a specified length.
|
|
2022
|
-
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2023
|
-
* @param len If not specified, defaults to `0`.
|
|
2024
|
-
*/
|
|
2025
|
-
function truncate(path: PathLike, len?: number): Promise<void>;
|
|
2026
|
-
|
|
2027
|
-
/**
|
|
2028
|
-
* Asynchronous ftruncate(2) - Truncate a file to a specified length.
|
|
2029
|
-
* @param handle A `FileHandle`.
|
|
2030
|
-
* @param len If not specified, defaults to `0`.
|
|
2031
|
-
*/
|
|
2032
|
-
function ftruncate(handle: FileHandle, len?: number): Promise<void>;
|
|
2033
|
-
|
|
2034
|
-
/**
|
|
2035
|
-
* Asynchronous rmdir(2) - delete a directory.
|
|
2036
|
-
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2037
|
-
*/
|
|
2038
|
-
function rmdir(path: PathLike): Promise<void>;
|
|
2039
|
-
|
|
2040
|
-
/**
|
|
2041
|
-
* Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device.
|
|
2042
|
-
* @param handle A `FileHandle`.
|
|
2043
|
-
*/
|
|
2044
|
-
function fdatasync(handle: FileHandle): Promise<void>;
|
|
2045
|
-
|
|
2046
|
-
/**
|
|
2047
|
-
* Asynchronous fsync(2) - synchronize a file's in-core state with the underlying storage device.
|
|
2048
|
-
* @param handle A `FileHandle`.
|
|
2049
|
-
*/
|
|
2050
|
-
function fsync(handle: FileHandle): Promise<void>;
|
|
2051
|
-
|
|
2052
|
-
/**
|
|
2053
|
-
* Asynchronous mkdir(2) - create a directory.
|
|
2054
|
-
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2055
|
-
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
|
|
2056
|
-
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
|
|
2057
|
-
*/
|
|
2058
|
-
function mkdir(path: PathLike, options?: number | string | MakeDirectoryOptions | null): Promise<void>;
|
|
2059
|
-
|
|
2060
|
-
/**
|
|
2061
|
-
* Asynchronous readdir(3) - read a directory.
|
|
2062
|
-
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2063
|
-
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
2064
|
-
*/
|
|
2065
|
-
function readdir(path: PathLike, options?: { encoding?: BufferEncoding | null; withFileTypes?: false } | BufferEncoding | null): Promise<string[]>;
|
|
2066
|
-
|
|
2067
|
-
/**
|
|
2068
|
-
* Asynchronous readdir(3) - read a directory.
|
|
2069
|
-
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2070
|
-
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
2071
|
-
*/
|
|
2072
|
-
function readdir(path: PathLike, options: { encoding: "buffer"; withFileTypes?: false } | "buffer"): Promise<Buffer[]>;
|
|
2073
|
-
|
|
2074
|
-
/**
|
|
2075
|
-
* Asynchronous readdir(3) - read a directory.
|
|
2076
|
-
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2077
|
-
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
2078
|
-
*/
|
|
2079
|
-
function readdir(path: PathLike, options?: { encoding?: string | null; withFileTypes?: false } | string | null): Promise<string[] | Buffer[]>;
|
|
2080
|
-
|
|
2081
|
-
/**
|
|
2082
|
-
* Asynchronous readdir(3) - read a directory.
|
|
2083
|
-
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2084
|
-
* @param options If called with `withFileTypes: true` the result data will be an array of Dirent.
|
|
2085
|
-
*/
|
|
2086
|
-
function readdir(path: PathLike, options: { encoding?: string | null; withFileTypes: true }): Promise<Dirent[]>;
|
|
2087
|
-
|
|
2088
|
-
/**
|
|
2089
|
-
* Asynchronous readlink(2) - read value of a symbolic link.
|
|
2090
|
-
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2091
|
-
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
2092
|
-
*/
|
|
2093
|
-
function readlink(path: PathLike, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): Promise<string>;
|
|
2094
|
-
|
|
2095
|
-
/**
|
|
2096
|
-
* Asynchronous readlink(2) - read value of a symbolic link.
|
|
2097
|
-
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2098
|
-
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
2099
|
-
*/
|
|
2100
|
-
function readlink(path: PathLike, options: { encoding: "buffer" } | "buffer"): Promise<Buffer>;
|
|
2101
|
-
|
|
2102
|
-
/**
|
|
2103
|
-
* Asynchronous readlink(2) - read value of a symbolic link.
|
|
2104
|
-
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2105
|
-
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
2106
|
-
*/
|
|
2107
|
-
function readlink(path: PathLike, options?: { encoding?: string | null } | string | null): Promise<string | Buffer>;
|
|
2108
|
-
|
|
2109
|
-
/**
|
|
2110
|
-
* Asynchronous symlink(2) - Create a new symbolic link to an existing file.
|
|
2111
|
-
* @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol.
|
|
2112
|
-
* @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol.
|
|
2113
|
-
* @param type May be set to `'dir'`, `'file'`, or `'junction'` (default is `'file'`) and is only available on Windows (ignored on other platforms).
|
|
2114
|
-
* When using `'junction'`, the `target` argument will automatically be normalized to an absolute path.
|
|
2115
|
-
*/
|
|
2116
|
-
function symlink(target: PathLike, path: PathLike, type?: string | null): Promise<void>;
|
|
2117
|
-
|
|
2118
|
-
/**
|
|
2119
|
-
* Asynchronous fstat(2) - Get file status.
|
|
2120
|
-
* @param handle A `FileHandle`.
|
|
2121
|
-
*/
|
|
2122
|
-
function fstat(handle: FileHandle): Promise<Stats>;
|
|
2123
|
-
|
|
2124
|
-
/**
|
|
2125
|
-
* Asynchronous lstat(2) - Get file status. Does not dereference symbolic links.
|
|
2126
|
-
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2127
|
-
*/
|
|
2128
|
-
function lstat(path: PathLike): Promise<Stats>;
|
|
2129
|
-
|
|
2130
|
-
/**
|
|
2131
|
-
* Asynchronous stat(2) - Get file status.
|
|
2132
|
-
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2133
|
-
*/
|
|
2134
|
-
function stat(path: PathLike): Promise<Stats>;
|
|
2135
|
-
|
|
2136
|
-
/**
|
|
2137
|
-
* Asynchronous link(2) - Create a new link (also known as a hard link) to an existing file.
|
|
2138
|
-
* @param existingPath A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2139
|
-
* @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2140
|
-
*/
|
|
2141
|
-
function link(existingPath: PathLike, newPath: PathLike): Promise<void>;
|
|
2142
|
-
|
|
2143
|
-
/**
|
|
2144
|
-
* Asynchronous unlink(2) - delete a name and possibly the file it refers to.
|
|
2145
|
-
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2146
|
-
*/
|
|
2147
|
-
function unlink(path: PathLike): Promise<void>;
|
|
2148
|
-
|
|
2149
|
-
/**
|
|
2150
|
-
* Asynchronous fchmod(2) - Change permissions of a file.
|
|
2151
|
-
* @param handle A `FileHandle`.
|
|
2152
|
-
* @param mode A file mode. If a string is passed, it is parsed as an octal integer.
|
|
2153
|
-
*/
|
|
2154
|
-
function fchmod(handle: FileHandle, mode: string | number): Promise<void>;
|
|
2155
|
-
|
|
2156
|
-
/**
|
|
2157
|
-
* Asynchronous chmod(2) - Change permissions of a file.
|
|
2158
|
-
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2159
|
-
* @param mode A file mode. If a string is passed, it is parsed as an octal integer.
|
|
2160
|
-
*/
|
|
2161
|
-
function chmod(path: PathLike, mode: string | number): Promise<void>;
|
|
2162
|
-
|
|
2163
|
-
/**
|
|
2164
|
-
* Asynchronous lchmod(2) - Change permissions of a file. Does not dereference symbolic links.
|
|
2165
|
-
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2166
|
-
* @param mode A file mode. If a string is passed, it is parsed as an octal integer.
|
|
2167
|
-
*/
|
|
2168
|
-
function lchmod(path: PathLike, mode: string | number): Promise<void>;
|
|
2169
|
-
|
|
2170
|
-
/**
|
|
2171
|
-
* Asynchronous lchown(2) - Change ownership of a file. Does not dereference symbolic links.
|
|
2172
|
-
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2173
|
-
*/
|
|
2174
|
-
function lchown(path: PathLike, uid: number, gid: number): Promise<void>;
|
|
2182
|
+
/**
|
|
2183
|
+
* Write an array of ArrayBufferViews to the file specified by fd using writev().
|
|
2184
|
+
* position is the offset from the beginning of the file where this data should be written.
|
|
2185
|
+
* It is unsafe to use fs.writev() multiple times on the same file without waiting for the callback. For this scenario, use fs.createWriteStream().
|
|
2186
|
+
* On Linux, positional writes don't work when the file is opened in append mode.
|
|
2187
|
+
* The kernel ignores the position argument and always appends the data to the end of the file.
|
|
2188
|
+
*/
|
|
2189
|
+
export function writev(
|
|
2190
|
+
fd: number,
|
|
2191
|
+
buffers: ReadonlyArray<NodeJS.ArrayBufferView>,
|
|
2192
|
+
cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: NodeJS.ArrayBufferView[]) => void
|
|
2193
|
+
): void;
|
|
2194
|
+
export function writev(
|
|
2195
|
+
fd: number,
|
|
2196
|
+
buffers: ReadonlyArray<NodeJS.ArrayBufferView>,
|
|
2197
|
+
position: number,
|
|
2198
|
+
cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: NodeJS.ArrayBufferView[]) => void
|
|
2199
|
+
): void;
|
|
2175
2200
|
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
function fchown(handle: FileHandle, uid: number, gid: number): Promise<void>;
|
|
2201
|
+
export interface WriteVResult {
|
|
2202
|
+
bytesWritten: number;
|
|
2203
|
+
buffers: NodeJS.ArrayBufferView[];
|
|
2204
|
+
}
|
|
2181
2205
|
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
*/
|
|
2186
|
-
function chown(path: PathLike, uid: number, gid: number): Promise<void>;
|
|
2206
|
+
export namespace writev {
|
|
2207
|
+
function __promisify__(fd: number, buffers: ReadonlyArray<NodeJS.ArrayBufferView>, position?: number): Promise<WriteVResult>;
|
|
2208
|
+
}
|
|
2187
2209
|
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
* @param mtime The last modified time. If a string is provided, it will be coerced to number.
|
|
2193
|
-
*/
|
|
2194
|
-
function utimes(path: PathLike, atime: string | number | Date, mtime: string | number | Date): Promise<void>;
|
|
2210
|
+
/**
|
|
2211
|
+
* See `writev`.
|
|
2212
|
+
*/
|
|
2213
|
+
export function writevSync(fd: number, buffers: ReadonlyArray<NodeJS.ArrayBufferView>, position?: number): number;
|
|
2195
2214
|
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2215
|
+
export function readv(
|
|
2216
|
+
fd: number,
|
|
2217
|
+
buffers: ReadonlyArray<NodeJS.ArrayBufferView>,
|
|
2218
|
+
cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: NodeJS.ArrayBufferView[]) => void
|
|
2219
|
+
): void;
|
|
2220
|
+
export function readv(
|
|
2221
|
+
fd: number,
|
|
2222
|
+
buffers: ReadonlyArray<NodeJS.ArrayBufferView>,
|
|
2223
|
+
position: number,
|
|
2224
|
+
cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: NodeJS.ArrayBufferView[]) => void
|
|
2225
|
+
): void;
|
|
2203
2226
|
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
*/
|
|
2209
|
-
function realpath(path: PathLike, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): Promise<string>;
|
|
2227
|
+
export interface ReadVResult {
|
|
2228
|
+
bytesRead: number;
|
|
2229
|
+
buffers: NodeJS.ArrayBufferView[];
|
|
2230
|
+
}
|
|
2210
2231
|
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
2215
|
-
*/
|
|
2216
|
-
function realpath(path: PathLike, options: { encoding: "buffer" } | "buffer"): Promise<Buffer>;
|
|
2232
|
+
export namespace readv {
|
|
2233
|
+
function __promisify__(fd: number, buffers: ReadonlyArray<NodeJS.ArrayBufferView>, position?: number): Promise<ReadVResult>;
|
|
2234
|
+
}
|
|
2217
2235
|
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
*/
|
|
2223
|
-
function realpath(path: PathLike, options?: { encoding?: string | null } | string | null): Promise<string | Buffer>;
|
|
2236
|
+
/**
|
|
2237
|
+
* See `readv`.
|
|
2238
|
+
*/
|
|
2239
|
+
export function readvSync(fd: number, buffers: ReadonlyArray<NodeJS.ArrayBufferView>, position?: number): number;
|
|
2224
2240
|
|
|
2241
|
+
export interface OpenDirOptions {
|
|
2242
|
+
encoding?: BufferEncoding | undefined;
|
|
2225
2243
|
/**
|
|
2226
|
-
*
|
|
2227
|
-
*
|
|
2228
|
-
*
|
|
2244
|
+
* Number of directory entries that are buffered
|
|
2245
|
+
* internally when reading from the directory. Higher values lead to better
|
|
2246
|
+
* performance but higher memory usage.
|
|
2247
|
+
* @default 32
|
|
2229
2248
|
*/
|
|
2230
|
-
|
|
2249
|
+
bufferSize?: number | undefined;
|
|
2250
|
+
}
|
|
2231
2251
|
|
|
2232
|
-
|
|
2233
|
-
* Asynchronously creates a unique temporary directory.
|
|
2234
|
-
* Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory.
|
|
2235
|
-
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
2236
|
-
*/
|
|
2237
|
-
function mkdtemp(prefix: string, options: { encoding: "buffer" } | "buffer"): Promise<Buffer>;
|
|
2252
|
+
export function opendirSync(path: PathLike, options?: OpenDirOptions): Dir;
|
|
2238
2253
|
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
* Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory.
|
|
2242
|
-
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
2243
|
-
*/
|
|
2244
|
-
function mkdtemp(prefix: string, options?: { encoding?: string | null } | string | null): Promise<string | Buffer>;
|
|
2254
|
+
export function opendir(path: PathLike, cb: (err: NodeJS.ErrnoException | null, dir: Dir) => void): void;
|
|
2255
|
+
export function opendir(path: PathLike, options: OpenDirOptions, cb: (err: NodeJS.ErrnoException | null, dir: Dir) => void): void;
|
|
2245
2256
|
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2250
|
-
* URL support is _experimental_.
|
|
2251
|
-
* If a `FileHandle` is provided, the underlying file will _not_ be closed automatically.
|
|
2252
|
-
* @param data The data to write. If something other than a `Buffer` or `Uint8Array` is provided, the value is coerced to a string.
|
|
2253
|
-
* @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag.
|
|
2254
|
-
* If `encoding` is not supplied, the default of `'utf8'` is used.
|
|
2255
|
-
* If `mode` is not supplied, the default of `0o666` is used.
|
|
2256
|
-
* If `mode` is a string, it is parsed as an octal integer.
|
|
2257
|
-
* If `flag` is not supplied, the default of `'w'` is used.
|
|
2258
|
-
*/
|
|
2259
|
-
function writeFile(path: PathLike | FileHandle, data: any, options?: { encoding?: string | null, mode?: string | number, flag?: string | number } | string | null): Promise<void>;
|
|
2257
|
+
export namespace opendir {
|
|
2258
|
+
function __promisify__(path: PathLike, options?: OpenDirOptions): Promise<Dir>;
|
|
2259
|
+
}
|
|
2260
2260
|
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
* @param file A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2264
|
-
* URL support is _experimental_.
|
|
2265
|
-
* If a `FileHandle` is provided, the underlying file will _not_ be closed automatically.
|
|
2266
|
-
* @param data The data to write. If something other than a `Buffer` or `Uint8Array` is provided, the value is coerced to a string.
|
|
2267
|
-
* @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag.
|
|
2268
|
-
* If `encoding` is not supplied, the default of `'utf8'` is used.
|
|
2269
|
-
* If `mode` is not supplied, the default of `0o666` is used.
|
|
2270
|
-
* If `mode` is a string, it is parsed as an octal integer.
|
|
2271
|
-
* If `flag` is not supplied, the default of `'a'` is used.
|
|
2272
|
-
*/
|
|
2273
|
-
function appendFile(path: PathLike | FileHandle, data: any, options?: { encoding?: string | null, mode?: string | number, flag?: string | number } | string | null): Promise<void>;
|
|
2261
|
+
export interface BigIntStats extends StatsBase<bigint> {
|
|
2262
|
+
}
|
|
2274
2263
|
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
*/
|
|
2282
|
-
function readFile(path: PathLike | FileHandle, options?: { encoding?: null, flag?: string | number } | null): Promise<Buffer>;
|
|
2264
|
+
export class BigIntStats {
|
|
2265
|
+
atimeNs: bigint;
|
|
2266
|
+
mtimeNs: bigint;
|
|
2267
|
+
ctimeNs: bigint;
|
|
2268
|
+
birthtimeNs: bigint;
|
|
2269
|
+
}
|
|
2283
2270
|
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
* If a `FileHandle` is provided, the underlying file will _not_ be closed automatically.
|
|
2288
|
-
* @param options An object that may contain an optional flag.
|
|
2289
|
-
* If a flag is not provided, it defaults to `'r'`.
|
|
2290
|
-
*/
|
|
2291
|
-
function readFile(path: PathLike | FileHandle, options: { encoding: BufferEncoding, flag?: string | number } | BufferEncoding): Promise<string>;
|
|
2271
|
+
export interface BigIntOptions {
|
|
2272
|
+
bigint: true;
|
|
2273
|
+
}
|
|
2292
2274
|
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2296
|
-
* If a `FileHandle` is provided, the underlying file will _not_ be closed automatically.
|
|
2297
|
-
* @param options An object that may contain an optional flag.
|
|
2298
|
-
* If a flag is not provided, it defaults to `'r'`.
|
|
2299
|
-
*/
|
|
2300
|
-
function readFile(path: PathLike | FileHandle, options?: { encoding?: string | null, flag?: string | number } | string | null): Promise<string | Buffer>;
|
|
2275
|
+
export interface StatOptions {
|
|
2276
|
+
bigint?: boolean | undefined;
|
|
2301
2277
|
}
|
|
2302
2278
|
}
|
|
2279
|
+
declare module 'node:fs' {
|
|
2280
|
+
export * from 'fs';
|
|
2281
|
+
}
|