@zenfs/core 0.9.6 → 0.9.7
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/dist/ApiError.d.ts +4 -3
- package/dist/ApiError.js +1 -1
- package/dist/backends/AsyncStore.d.ts +3 -2
- package/dist/backends/AsyncStore.js +12 -5
- package/dist/backends/InMemory.d.ts +1 -1
- package/dist/backends/Index.d.ts +7 -10
- package/dist/backends/Index.js +7 -5
- package/dist/backends/Overlay.js +1 -1
- package/dist/backends/SyncStore.d.ts +6 -6
- package/dist/backends/SyncStore.js +4 -4
- package/dist/backends/backend.d.ts +5 -4
- package/dist/backends/backend.js +2 -2
- package/dist/browser.min.js +4 -4
- package/dist/browser.min.js.map +3 -3
- package/dist/config.d.ts +1 -1
- package/dist/config.js +2 -2
- package/dist/emulation/async.d.ts +76 -77
- package/dist/emulation/async.js +42 -42
- package/dist/emulation/dir.js +6 -5
- package/dist/emulation/promises.d.ts +106 -102
- package/dist/emulation/promises.js +61 -65
- package/dist/emulation/shared.d.ts +1 -7
- package/dist/emulation/shared.js +1 -1
- package/dist/emulation/streams.js +3 -2
- package/dist/emulation/sync.d.ts +71 -64
- package/dist/emulation/sync.js +39 -40
- package/dist/file.d.ts +4 -4
- package/dist/file.js +7 -5
- package/dist/filesystem.d.ts +1 -1
- package/dist/filesystem.js +3 -0
- package/dist/mutex.js +2 -2
- package/dist/stats.d.ts +7 -7
- package/dist/stats.js +50 -10
- package/dist/utils.d.ts +5 -5
- package/dist/utils.js +4 -3
- package/package.json +3 -3
- package/readme.md +2 -2
- package/src/ApiError.ts +3 -1
- package/src/backends/AsyncStore.ts +14 -8
- package/src/backends/Index.ts +14 -10
- package/src/backends/Overlay.ts +3 -3
- package/src/backends/SyncStore.ts +8 -8
- package/src/backends/backend.ts +7 -5
- package/src/config.ts +5 -5
- package/src/emulation/async.ts +188 -196
- package/src/emulation/dir.ts +6 -6
- package/src/emulation/promises.ts +181 -173
- package/src/emulation/shared.ts +2 -9
- package/src/emulation/streams.ts +9 -8
- package/src/emulation/sync.ts +159 -159
- package/src/file.ts +11 -9
- package/src/filesystem.ts +11 -7
- package/src/mutex.ts +3 -3
- package/src/stats.ts +32 -23
- package/src/utils.ts +10 -9
- package/tsconfig.json +2 -1
|
@@ -4,17 +4,18 @@
|
|
|
4
4
|
/// <reference types="node" resolution-mode="require"/>
|
|
5
5
|
/// <reference types="node" resolution-mode="require"/>
|
|
6
6
|
/// <reference types="node" resolution-mode="require"/>
|
|
7
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
7
8
|
import { Buffer } from 'buffer';
|
|
8
|
-
import type * as
|
|
9
|
+
import type * as fs from 'node:fs';
|
|
9
10
|
import type * as promises from 'node:fs/promises';
|
|
10
11
|
import type { CreateReadStreamOptions, CreateWriteStreamOptions, FileChangeInfo, FileReadResult, FlagAndOpenMode } from 'node:fs/promises';
|
|
12
|
+
import type { Stream } from 'node:stream';
|
|
11
13
|
import type { ReadableStream as TReadableStream } from 'node:stream/web';
|
|
12
14
|
import type { Interface as ReadlineInterface } from 'readline';
|
|
13
15
|
import { File } from '../file.js';
|
|
14
16
|
import { FileContents } from '../filesystem.js';
|
|
15
17
|
import { BigIntStats, type BigIntStatsFs, type Stats, type StatsFs } from '../stats.js';
|
|
16
18
|
import { Dir, Dirent } from './dir.js';
|
|
17
|
-
import type { PathLike } from './shared.js';
|
|
18
19
|
import { ReadStream, WriteStream } from './streams.js';
|
|
19
20
|
export * as constants from './constants.js';
|
|
20
21
|
export declare class FileHandle implements promises.FileHandle {
|
|
@@ -39,7 +40,7 @@ export declare class FileHandle implements promises.FileHandle {
|
|
|
39
40
|
* Asynchronous fchmod(2) - Change permissions of a file.
|
|
40
41
|
* @param mode A file mode. If a string is passed, it is parsed as an octal integer.
|
|
41
42
|
*/
|
|
42
|
-
chmod(mode:
|
|
43
|
+
chmod(mode: fs.Mode): Promise<void>;
|
|
43
44
|
/**
|
|
44
45
|
* Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device.
|
|
45
46
|
*/
|
|
@@ -52,7 +53,7 @@ export declare class FileHandle implements promises.FileHandle {
|
|
|
52
53
|
* Asynchronous ftruncate(2) - Truncate a file to a specified length.
|
|
53
54
|
* @param len If not specified, defaults to `0`.
|
|
54
55
|
*/
|
|
55
|
-
truncate(len?: number): Promise<void>;
|
|
56
|
+
truncate(len?: number | null): Promise<void>;
|
|
56
57
|
/**
|
|
57
58
|
* Asynchronously change file timestamps of the file.
|
|
58
59
|
* @param atime The last access time. If a string is provided, it will be coerced to number.
|
|
@@ -69,7 +70,7 @@ export declare class FileHandle implements promises.FileHandle {
|
|
|
69
70
|
* If `mode` is a string, it is parsed as an octal integer.
|
|
70
71
|
* If `flag` is not supplied, the default of `'a'` is used.
|
|
71
72
|
*/
|
|
72
|
-
appendFile(data: string | Uint8Array, _options?: (
|
|
73
|
+
appendFile(data: string | Uint8Array, _options?: (fs.ObjectEncodingOptions & FlagAndOpenMode) | BufferEncoding): Promise<void>;
|
|
73
74
|
/**
|
|
74
75
|
* Asynchronously reads data from the file.
|
|
75
76
|
* The `FileHandle` must have been opened for reading.
|
|
@@ -78,7 +79,7 @@ export declare class FileHandle implements promises.FileHandle {
|
|
|
78
79
|
* @param length The number of bytes to read.
|
|
79
80
|
* @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.
|
|
80
81
|
*/
|
|
81
|
-
read<TBuffer extends NodeJS.ArrayBufferView>(buffer: TBuffer, offset?: number, length?: number, position?: number): Promise<FileReadResult<TBuffer>>;
|
|
82
|
+
read<TBuffer extends NodeJS.ArrayBufferView>(buffer: TBuffer, offset?: number, length?: number, position?: number | null): Promise<FileReadResult<TBuffer>>;
|
|
82
83
|
/**
|
|
83
84
|
* Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically.
|
|
84
85
|
* The `FileHandle` must have been opened for reading.
|
|
@@ -86,9 +87,9 @@ export declare class FileHandle implements promises.FileHandle {
|
|
|
86
87
|
* If a flag is not provided, it defaults to `'r'`.
|
|
87
88
|
*/
|
|
88
89
|
readFile(_options?: {
|
|
89
|
-
flag?:
|
|
90
|
+
flag?: fs.OpenMode;
|
|
90
91
|
}): Promise<Buffer>;
|
|
91
|
-
readFile(_options: (
|
|
92
|
+
readFile(_options: (fs.ObjectEncodingOptions & FlagAndOpenMode) | BufferEncoding): Promise<string>;
|
|
92
93
|
/**
|
|
93
94
|
* Returns a `ReadableStream` that may be used to read the files data.
|
|
94
95
|
*
|
|
@@ -106,35 +107,24 @@ export declare class FileHandle implements promises.FileHandle {
|
|
|
106
107
|
/**
|
|
107
108
|
* Asynchronous fstat(2) - Get file status.
|
|
108
109
|
*/
|
|
109
|
-
stat(opts:
|
|
110
|
-
stat(opts?:
|
|
110
|
+
stat(opts: fs.BigIntOptions): Promise<BigIntStats>;
|
|
111
|
+
stat(opts?: fs.StatOptions & {
|
|
111
112
|
bigint?: false;
|
|
112
113
|
}): Promise<Stats>;
|
|
113
|
-
write(data: FileContents, posOrOff?: number, lenOrEnc?: BufferEncoding | number, position?: number): Promise<{
|
|
114
|
-
bytesWritten: number;
|
|
115
|
-
buffer: FileContents;
|
|
116
|
-
}>;
|
|
117
114
|
/**
|
|
118
|
-
* Asynchronously writes `
|
|
115
|
+
* Asynchronously writes `string` to the file.
|
|
119
116
|
* The `FileHandle` must have been opened for writing.
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
* @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`.
|
|
123
|
-
* @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
|
|
117
|
+
* It is unsafe to call `write()` multiple times on the same file without waiting for the `Promise`
|
|
118
|
+
* to be resolved (or rejected). For this scenario, `fs.createWriteStream` is strongly recommended.
|
|
124
119
|
*/
|
|
120
|
+
write(data: FileContents, posOrOff?: number | null, lenOrEnc?: BufferEncoding | number, position?: number | null): Promise<{
|
|
121
|
+
bytesWritten: number;
|
|
122
|
+
buffer: FileContents;
|
|
123
|
+
}>;
|
|
125
124
|
write<TBuffer extends Uint8Array>(buffer: TBuffer, offset?: number, length?: number, position?: number): Promise<{
|
|
126
125
|
bytesWritten: number;
|
|
127
126
|
buffer: TBuffer;
|
|
128
127
|
}>;
|
|
129
|
-
/**
|
|
130
|
-
* Asynchronously writes `string` to the file.
|
|
131
|
-
* The `FileHandle` must have been opened for writing.
|
|
132
|
-
* It is unsafe to call `write()` multiple times on the same file without waiting for the `Promise`
|
|
133
|
-
* to be resolved (or rejected). For this scenario, `fs.createWriteStream` is strongly recommended.
|
|
134
|
-
* @param string A string to write.
|
|
135
|
-
* @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
|
|
136
|
-
* @param encoding The expected string encoding.
|
|
137
|
-
*/
|
|
138
128
|
write(data: string, position?: number, encoding?: BufferEncoding): Promise<{
|
|
139
129
|
bytesWritten: number;
|
|
140
130
|
buffer: string;
|
|
@@ -150,7 +140,7 @@ export declare class FileHandle implements promises.FileHandle {
|
|
|
150
140
|
* If `mode` is a string, it is parsed as an octal integer.
|
|
151
141
|
* If `flag` is not supplied, the default of `'w'` is used.
|
|
152
142
|
*/
|
|
153
|
-
writeFile(data: string | Uint8Array, _options?:
|
|
143
|
+
writeFile(data: string | Uint8Array, _options?: fs.WriteFileOptions): Promise<void>;
|
|
154
144
|
/**
|
|
155
145
|
* Asynchronous close(2) - close a `FileHandle`.
|
|
156
146
|
*/
|
|
@@ -161,14 +151,14 @@ export declare class FileHandle implements promises.FileHandle {
|
|
|
161
151
|
* @param position The position in the file where to begin writing.
|
|
162
152
|
* @returns The number of bytes written.
|
|
163
153
|
*/
|
|
164
|
-
writev(buffers: Uint8Array[], position?: number): Promise<
|
|
154
|
+
writev(buffers: Uint8Array[], position?: number): Promise<fs.WriteVResult>;
|
|
165
155
|
/**
|
|
166
156
|
* Asynchronous `readv`. Reads into multiple buffers.
|
|
167
157
|
* @param buffers An array of Uint8Array buffers.
|
|
168
158
|
* @param position The position in the file where to begin reading.
|
|
169
159
|
* @returns The number of bytes read.
|
|
170
160
|
*/
|
|
171
|
-
readv(buffers: NodeJS.ArrayBufferView[], position?: number): Promise<
|
|
161
|
+
readv(buffers: NodeJS.ArrayBufferView[], position?: number): Promise<fs.ReadVResult>;
|
|
172
162
|
/**
|
|
173
163
|
* Creates a `ReadStream` for reading from the file.
|
|
174
164
|
*
|
|
@@ -189,22 +179,22 @@ export declare class FileHandle implements promises.FileHandle {
|
|
|
189
179
|
* @param oldPath
|
|
190
180
|
* @param newPath
|
|
191
181
|
*/
|
|
192
|
-
export declare function rename(oldPath: PathLike, newPath: PathLike): Promise<void>;
|
|
182
|
+
export declare function rename(oldPath: fs.PathLike, newPath: fs.PathLike): Promise<void>;
|
|
193
183
|
/**
|
|
194
184
|
* Test whether or not the given path exists by checking with the file system.
|
|
195
185
|
* @param _path
|
|
196
186
|
*/
|
|
197
|
-
export declare function exists(_path: PathLike): Promise<boolean>;
|
|
187
|
+
export declare function exists(_path: fs.PathLike): Promise<boolean>;
|
|
198
188
|
/**
|
|
199
189
|
* `stat`.
|
|
200
190
|
* @param path
|
|
201
191
|
* @returns Stats
|
|
202
192
|
*/
|
|
203
|
-
export declare function stat(path: PathLike, options:
|
|
204
|
-
export declare function stat(path: PathLike, options?: {
|
|
193
|
+
export declare function stat(path: fs.PathLike, options: fs.BigIntOptions): Promise<BigIntStats>;
|
|
194
|
+
export declare function stat(path: fs.PathLike, options?: {
|
|
205
195
|
bigint?: false;
|
|
206
196
|
}): Promise<Stats>;
|
|
207
|
-
export declare function stat(path: PathLike, options?:
|
|
197
|
+
export declare function stat(path: fs.PathLike, options?: fs.StatOptions): Promise<Stats | BigIntStats>;
|
|
208
198
|
/**
|
|
209
199
|
* `lstat`.
|
|
210
200
|
* `lstat()` is identical to `stat()`, except that if path is a symbolic link,
|
|
@@ -212,10 +202,10 @@ export declare function stat(path: PathLike, options?: Node.StatOptions): Promis
|
|
|
212
202
|
* @param path
|
|
213
203
|
* @return
|
|
214
204
|
*/
|
|
215
|
-
export declare function lstat(path: PathLike, options?: {
|
|
216
|
-
bigint?:
|
|
205
|
+
export declare function lstat(path: fs.PathLike, options?: {
|
|
206
|
+
bigint?: boolean;
|
|
217
207
|
}): Promise<Stats>;
|
|
218
|
-
export declare function lstat(path: PathLike, options: {
|
|
208
|
+
export declare function lstat(path: fs.PathLike, options: {
|
|
219
209
|
bigint: true;
|
|
220
210
|
}): Promise<BigIntStats>;
|
|
221
211
|
/**
|
|
@@ -223,24 +213,19 @@ export declare function lstat(path: PathLike, options: {
|
|
|
223
213
|
* @param path
|
|
224
214
|
* @param len
|
|
225
215
|
*/
|
|
226
|
-
export declare function truncate(path: PathLike, len?: number): Promise<void>;
|
|
216
|
+
export declare function truncate(path: fs.PathLike, len?: number): Promise<void>;
|
|
227
217
|
/**
|
|
228
218
|
* `unlink`.
|
|
229
219
|
* @param path
|
|
230
220
|
*/
|
|
231
|
-
export declare function unlink(path: PathLike): Promise<void>;
|
|
221
|
+
export declare function unlink(path: fs.PathLike): Promise<void>;
|
|
232
222
|
/**
|
|
233
223
|
* Asynchronous file open.
|
|
234
224
|
* @see http://www.manpagez.com/man/2/open/
|
|
235
225
|
* @param flags Handles the complexity of the various file modes. See its API for more details.
|
|
236
226
|
* @param mode Mode to use to open the file. Can be ignored if the filesystem doesn't support permissions.
|
|
237
227
|
*/
|
|
238
|
-
export declare function open(path: PathLike, flag
|
|
239
|
-
/**
|
|
240
|
-
* Opens a file without resolving symlinks
|
|
241
|
-
* @internal
|
|
242
|
-
*/
|
|
243
|
-
export declare function lopen(path: PathLike, flag: string, mode?: Node.Mode): Promise<FileHandle>;
|
|
228
|
+
export declare function open(path: fs.PathLike, flag?: fs.OpenMode, mode?: fs.Mode): Promise<FileHandle>;
|
|
244
229
|
/**
|
|
245
230
|
* Asynchronously reads the entire contents of a file.
|
|
246
231
|
* @param filename
|
|
@@ -249,126 +234,146 @@ export declare function lopen(path: PathLike, flag: string, mode?: Node.Mode): P
|
|
|
249
234
|
* options.flag Defaults to `'r'`.
|
|
250
235
|
* @returns file data
|
|
251
236
|
*/
|
|
252
|
-
export declare function readFile(
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
237
|
+
export declare function readFile(path: fs.PathLike | promises.FileHandle, options?: {
|
|
238
|
+
encoding?: null;
|
|
239
|
+
flag?: fs.OpenMode;
|
|
240
|
+
} | null): Promise<Buffer>;
|
|
241
|
+
export declare function readFile(path: fs.PathLike | promises.FileHandle, options: {
|
|
242
|
+
encoding: BufferEncoding;
|
|
243
|
+
flag?: fs.OpenMode;
|
|
244
|
+
} | BufferEncoding): Promise<string>;
|
|
245
|
+
export declare function readFile(path: fs.PathLike | promises.FileHandle, options?: (fs.ObjectEncodingOptions & {
|
|
246
|
+
flag?: fs.OpenMode;
|
|
247
|
+
}) | BufferEncoding | null): Promise<string | Buffer>;
|
|
258
248
|
/**
|
|
259
249
|
* Asynchronously writes data to a file, replacing the file if it already exists.
|
|
260
250
|
*
|
|
261
251
|
* The encoding option is ignored if data is a buffer.
|
|
262
|
-
* @param
|
|
263
|
-
* @param data
|
|
252
|
+
* @param path
|
|
253
|
+
* @param data Note:
|
|
264
254
|
* @param _options
|
|
265
255
|
* @option options encoding Defaults to `'utf8'`.
|
|
266
256
|
* @option options mode Defaults to `0644`.
|
|
267
257
|
* @option options flag Defaults to `'w'`.
|
|
268
258
|
*/
|
|
269
|
-
export declare function writeFile(
|
|
259
|
+
export declare function writeFile(path: fs.PathLike | promises.FileHandle, data: FileContents | Stream | Iterable<string | ArrayBufferView> | AsyncIterable<string | ArrayBufferView>, _options?: (fs.ObjectEncodingOptions & {
|
|
260
|
+
mode?: fs.Mode;
|
|
261
|
+
flag?: fs.OpenMode;
|
|
262
|
+
flush?: boolean;
|
|
263
|
+
}) | BufferEncoding | null): Promise<void>;
|
|
270
264
|
/**
|
|
271
265
|
* Asynchronously append data to a file, creating the file if it not yet
|
|
272
266
|
* exists.
|
|
273
|
-
* @param
|
|
267
|
+
* @param path
|
|
274
268
|
* @param data
|
|
275
269
|
* @param options
|
|
276
270
|
* @option options encoding Defaults to `'utf8'`.
|
|
277
271
|
* @option options mode Defaults to `0644`.
|
|
278
272
|
* @option options flag Defaults to `'a'`.
|
|
279
273
|
*/
|
|
280
|
-
export declare function appendFile(
|
|
281
|
-
mode?:
|
|
282
|
-
flag?:
|
|
283
|
-
})): Promise<void>;
|
|
274
|
+
export declare function appendFile(path: fs.PathLike | promises.FileHandle, data: FileContents, _options?: BufferEncoding | (fs.EncodingOption & {
|
|
275
|
+
mode?: fs.Mode;
|
|
276
|
+
flag?: fs.OpenMode;
|
|
277
|
+
}) | null): Promise<void>;
|
|
284
278
|
/**
|
|
285
279
|
* `rmdir`.
|
|
286
280
|
* @param path
|
|
287
281
|
*/
|
|
288
|
-
export declare function rmdir(path: PathLike): Promise<void>;
|
|
282
|
+
export declare function rmdir(path: fs.PathLike): Promise<void>;
|
|
289
283
|
/**
|
|
290
|
-
*
|
|
291
|
-
* @param path
|
|
292
|
-
* @param mode
|
|
284
|
+
* Asynchronous mkdir(2) - create a directory.
|
|
285
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
286
|
+
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
|
|
287
|
+
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
|
|
293
288
|
*/
|
|
294
|
-
export declare function mkdir(path: PathLike,
|
|
295
|
-
recursive?: false;
|
|
296
|
-
})): Promise<void>;
|
|
297
|
-
export declare function mkdir(path: PathLike, mode: Node.MakeDirectoryOptions & {
|
|
289
|
+
export declare function mkdir(path: fs.PathLike, options: fs.MakeDirectoryOptions & {
|
|
298
290
|
recursive: true;
|
|
299
|
-
}): Promise<string>;
|
|
291
|
+
}): Promise<string | undefined>;
|
|
292
|
+
export declare function mkdir(path: fs.PathLike, options?: fs.Mode | (fs.MakeDirectoryOptions & {
|
|
293
|
+
recursive?: false | undefined;
|
|
294
|
+
}) | null): Promise<void>;
|
|
295
|
+
export declare function mkdir(path: fs.PathLike, options?: fs.Mode | fs.MakeDirectoryOptions | null): Promise<string | undefined>;
|
|
300
296
|
/**
|
|
301
|
-
*
|
|
302
|
-
* @param path
|
|
297
|
+
* Asynchronous readdir(3) - read a directory.
|
|
298
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
299
|
+
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
303
300
|
*/
|
|
304
|
-
export declare function readdir(path: PathLike, options?: (
|
|
301
|
+
export declare function readdir(path: fs.PathLike, options?: (fs.ObjectEncodingOptions & {
|
|
305
302
|
withFileTypes?: false;
|
|
306
|
-
|
|
307
|
-
|
|
303
|
+
recursive?: boolean;
|
|
304
|
+
}) | BufferEncoding | null): Promise<string[]>;
|
|
305
|
+
export declare function readdir(path: fs.PathLike, options: fs.BufferEncodingOption & {
|
|
308
306
|
withFileTypes?: false;
|
|
307
|
+
recursive?: boolean;
|
|
309
308
|
}): Promise<Buffer[]>;
|
|
310
|
-
export declare function readdir(path: PathLike, options
|
|
309
|
+
export declare function readdir(path: fs.PathLike, options?: (fs.ObjectEncodingOptions & {
|
|
310
|
+
withFileTypes?: false;
|
|
311
|
+
recursive?: boolean;
|
|
312
|
+
}) | BufferEncoding | null): Promise<string[] | Buffer[]>;
|
|
313
|
+
export declare function readdir(path: fs.PathLike, options: fs.ObjectEncodingOptions & {
|
|
311
314
|
withFileTypes: true;
|
|
315
|
+
recursive?: boolean;
|
|
312
316
|
}): Promise<Dirent[]>;
|
|
313
317
|
/**
|
|
314
318
|
* `link`.
|
|
315
319
|
* @param existing
|
|
316
320
|
* @param newpath
|
|
317
321
|
*/
|
|
318
|
-
export declare function link(existing: PathLike, newpath: PathLike): Promise<void>;
|
|
322
|
+
export declare function link(existing: fs.PathLike, newpath: fs.PathLike): Promise<void>;
|
|
319
323
|
/**
|
|
320
324
|
* `symlink`.
|
|
321
325
|
* @param target target path
|
|
322
326
|
* @param path link path
|
|
323
327
|
* @param type can be either `'dir'` or `'file'` (default is `'file'`)
|
|
324
328
|
*/
|
|
325
|
-
export declare function symlink(target: PathLike, path: PathLike, type?:
|
|
329
|
+
export declare function symlink(target: fs.PathLike, path: fs.PathLike, type?: fs.symlink.Type | string | null): Promise<void>;
|
|
326
330
|
/**
|
|
327
331
|
* readlink.
|
|
328
332
|
* @param path
|
|
329
333
|
*/
|
|
330
|
-
export declare function readlink(path: PathLike, options:
|
|
331
|
-
export declare function readlink(path: PathLike, options?:
|
|
334
|
+
export declare function readlink(path: fs.PathLike, options: fs.BufferEncodingOption): Promise<Buffer>;
|
|
335
|
+
export declare function readlink(path: fs.PathLike, options?: fs.EncodingOption | null): Promise<string>;
|
|
336
|
+
export declare function readlink(path: fs.PathLike, options?: fs.BufferEncodingOption | fs.EncodingOption | string | null): Promise<string | Buffer>;
|
|
332
337
|
/**
|
|
333
338
|
* `chown`.
|
|
334
339
|
* @param path
|
|
335
340
|
* @param uid
|
|
336
341
|
* @param gid
|
|
337
342
|
*/
|
|
338
|
-
export declare function chown(path: PathLike, uid: number, gid: number): Promise<void>;
|
|
343
|
+
export declare function chown(path: fs.PathLike, uid: number, gid: number): Promise<void>;
|
|
339
344
|
/**
|
|
340
345
|
* `lchown`.
|
|
341
346
|
* @param path
|
|
342
347
|
* @param uid
|
|
343
348
|
* @param gid
|
|
344
349
|
*/
|
|
345
|
-
export declare function lchown(path: PathLike, uid: number, gid: number): Promise<void>;
|
|
350
|
+
export declare function lchown(path: fs.PathLike, uid: number, gid: number): Promise<void>;
|
|
346
351
|
/**
|
|
347
352
|
* `chmod`.
|
|
348
353
|
* @param path
|
|
349
354
|
* @param mode
|
|
350
355
|
*/
|
|
351
|
-
export declare function chmod(path: PathLike, mode:
|
|
356
|
+
export declare function chmod(path: fs.PathLike, mode: fs.Mode): Promise<void>;
|
|
352
357
|
/**
|
|
353
358
|
* `lchmod`.
|
|
354
359
|
* @param path
|
|
355
360
|
* @param mode
|
|
356
361
|
*/
|
|
357
|
-
export declare function lchmod(path: PathLike, mode:
|
|
362
|
+
export declare function lchmod(path: fs.PathLike, mode: fs.Mode): Promise<void>;
|
|
358
363
|
/**
|
|
359
364
|
* Change file timestamps of the file referenced by the supplied path.
|
|
360
365
|
* @param path
|
|
361
366
|
* @param atime
|
|
362
367
|
* @param mtime
|
|
363
368
|
*/
|
|
364
|
-
export declare function utimes(path: PathLike, atime: string | number | Date, mtime: string | number | Date): Promise<void>;
|
|
369
|
+
export declare function utimes(path: fs.PathLike, atime: string | number | Date, mtime: string | number | Date): Promise<void>;
|
|
365
370
|
/**
|
|
366
371
|
* Change file timestamps of the file referenced by the supplied path.
|
|
367
372
|
* @param path
|
|
368
373
|
* @param atime
|
|
369
374
|
* @param mtime
|
|
370
375
|
*/
|
|
371
|
-
export declare function lutimes(path: PathLike, atime:
|
|
376
|
+
export declare function lutimes(path: fs.PathLike, atime: fs.TimeLike, mtime: fs.TimeLike): Promise<void>;
|
|
372
377
|
/**
|
|
373
378
|
* Asynchronous realpath(3) - return the canonicalized absolute pathname.
|
|
374
379
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -376,34 +381,33 @@ export declare function lutimes(path: PathLike, atime: number | Date, mtime: num
|
|
|
376
381
|
*
|
|
377
382
|
* Note: This *Can not* use doOp since doOp depends on it
|
|
378
383
|
*/
|
|
379
|
-
export declare function realpath(path: PathLike, options:
|
|
380
|
-
export declare function realpath(path: PathLike, options?:
|
|
384
|
+
export declare function realpath(path: fs.PathLike, options: fs.BufferEncodingOption): Promise<Buffer>;
|
|
385
|
+
export declare function realpath(path: fs.PathLike, options?: fs.EncodingOption | BufferEncoding): Promise<string>;
|
|
381
386
|
/**
|
|
382
387
|
* @todo Implement
|
|
383
388
|
*/
|
|
384
|
-
export declare function watch(filename: PathLike, options
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
export declare function watch(filename: PathLike, options?: Node.WatchOptions | BufferEncoding): AsyncIterable<FileChangeInfo<string>>;
|
|
389
|
+
export declare function watch(filename: fs.PathLike, options?: fs.WatchOptions | BufferEncoding): AsyncIterable<FileChangeInfo<string>>;
|
|
390
|
+
export declare function watch(filename: fs.PathLike, options: fs.WatchOptions | fs.BufferEncodingOption): AsyncIterable<FileChangeInfo<Buffer>>;
|
|
391
|
+
export declare function watch(filename: fs.PathLike, options?: fs.WatchOptions | string): AsyncIterable<FileChangeInfo<string>> | AsyncIterable<FileChangeInfo<Buffer>>;
|
|
388
392
|
/**
|
|
389
393
|
* `access`.
|
|
390
394
|
* @param path
|
|
391
395
|
* @param mode
|
|
392
396
|
*/
|
|
393
|
-
export declare function access(path: PathLike, mode?: number): Promise<void>;
|
|
397
|
+
export declare function access(path: fs.PathLike, mode?: number): Promise<void>;
|
|
394
398
|
/**
|
|
395
399
|
* Asynchronous `rm`. Removes files or directories (recursively).
|
|
396
400
|
* @param path The path to the file or directory to remove.
|
|
397
401
|
*/
|
|
398
|
-
export declare function rm(path: PathLike, options?:
|
|
402
|
+
export declare function rm(path: fs.PathLike, options?: fs.RmOptions): Promise<void>;
|
|
399
403
|
/**
|
|
400
404
|
* Asynchronous `mkdtemp`. Creates a unique temporary directory.
|
|
401
405
|
* @param prefix The directory prefix.
|
|
402
406
|
* @param options The encoding (or an object including `encoding`).
|
|
403
407
|
* @returns The path to the created temporary directory, encoded as a string or buffer.
|
|
404
408
|
*/
|
|
405
|
-
export declare function mkdtemp(prefix: string, options?:
|
|
406
|
-
export declare function mkdtemp(prefix: string, options?:
|
|
409
|
+
export declare function mkdtemp(prefix: string, options?: fs.EncodingOption): Promise<string>;
|
|
410
|
+
export declare function mkdtemp(prefix: string, options?: fs.BufferEncodingOption): Promise<Buffer>;
|
|
407
411
|
/**
|
|
408
412
|
* Asynchronous `copyFile`. Copies a file.
|
|
409
413
|
* @param src The source file.
|
|
@@ -411,14 +415,14 @@ export declare function mkdtemp(prefix: string, options?: Node.BufferEncodingOpt
|
|
|
411
415
|
* @param mode Optional flags for the copy operation. Currently supports these flags:
|
|
412
416
|
* * `fs.constants.COPYFILE_EXCL`: If the destination file already exists, the operation fails.
|
|
413
417
|
*/
|
|
414
|
-
export declare function copyFile(src: PathLike, dest: PathLike, mode?: number): Promise<void>;
|
|
418
|
+
export declare function copyFile(src: fs.PathLike, dest: fs.PathLike, mode?: number): Promise<void>;
|
|
415
419
|
/**
|
|
416
420
|
* Asynchronous `opendir`. Opens a directory.
|
|
417
421
|
* @param path The path to the directory.
|
|
418
422
|
* @param options Options for opening the directory.
|
|
419
423
|
* @returns A `Dir` object representing the opened directory.
|
|
420
424
|
*/
|
|
421
|
-
export declare function opendir(path: PathLike, options?:
|
|
425
|
+
export declare function opendir(path: fs.PathLike, options?: fs.OpenDirOptions): Promise<Dir>;
|
|
422
426
|
/**
|
|
423
427
|
* Asynchronous `cp`. Recursively copies a file or directory.
|
|
424
428
|
* @param source The source file or directory.
|
|
@@ -431,15 +435,15 @@ export declare function opendir(path: PathLike, options?: Node.OpenDirOptions):
|
|
|
431
435
|
* * `preserveTimestamps`: Preserve file timestamps.
|
|
432
436
|
* * `recursive`: If `true`, copies directories recursively.
|
|
433
437
|
*/
|
|
434
|
-
export declare function cp(source: PathLike, destination: PathLike, opts?:
|
|
438
|
+
export declare function cp(source: fs.PathLike, destination: fs.PathLike, opts?: fs.CopyOptions): Promise<void>;
|
|
435
439
|
/**
|
|
436
440
|
* @since v18.15.0
|
|
437
441
|
* @return Fulfills with an {fs.StatFs} for the file system.
|
|
438
442
|
*/
|
|
439
|
-
export declare function statfs(path: PathLike, opts?:
|
|
443
|
+
export declare function statfs(path: fs.PathLike, opts?: fs.StatFsOptions & {
|
|
440
444
|
bigint?: false;
|
|
441
445
|
}): Promise<StatsFs>;
|
|
442
|
-
export declare function statfs(path: PathLike, opts:
|
|
446
|
+
export declare function statfs(path: fs.PathLike, opts: fs.StatFsOptions & {
|
|
443
447
|
bigint: true;
|
|
444
448
|
}): Promise<BigIntStatsFs>;
|
|
445
|
-
export declare function statfs(path: PathLike, opts?:
|
|
449
|
+
export declare function statfs(path: fs.PathLike, opts?: fs.StatFsOptions): Promise<StatsFs | BigIntStatsFs>;
|