@zenfs/core 1.0.10 → 1.0.11

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.
Files changed (71) hide show
  1. package/dist/backends/backend.d.ts +4 -8
  2. package/dist/backends/backend.js +7 -11
  3. package/dist/backends/fetch.d.ts +2 -4
  4. package/dist/backends/fetch.js +1 -3
  5. package/dist/backends/memory.d.ts +1 -1
  6. package/dist/backends/overlay.d.ts +7 -3
  7. package/dist/backends/overlay.js +10 -6
  8. package/dist/backends/port/fs.d.ts +12 -17
  9. package/dist/backends/port/fs.js +5 -8
  10. package/dist/backends/port/rpc.d.ts +1 -1
  11. package/dist/backends/store/fs.d.ts +8 -10
  12. package/dist/backends/store/fs.js +30 -49
  13. package/dist/backends/store/simple.d.ts +1 -1
  14. package/dist/backends/store/simple.js +1 -1
  15. package/dist/backends/store/store.d.ts +7 -13
  16. package/dist/config.d.ts +5 -5
  17. package/dist/config.js +26 -26
  18. package/dist/emulation/async.d.ts +21 -176
  19. package/dist/emulation/async.js +17 -111
  20. package/dist/emulation/dir.d.ts +0 -1
  21. package/dist/emulation/path.d.ts +0 -4
  22. package/dist/emulation/path.js +4 -8
  23. package/dist/emulation/promises.d.ts +31 -121
  24. package/dist/emulation/promises.js +30 -97
  25. package/dist/emulation/shared.d.ts +7 -3
  26. package/dist/emulation/shared.js +8 -5
  27. package/dist/emulation/streams.d.ts +0 -3
  28. package/dist/emulation/sync.d.ts +25 -178
  29. package/dist/emulation/sync.js +36 -129
  30. package/dist/emulation/watchers.d.ts +0 -4
  31. package/dist/error.d.ts +11 -11
  32. package/dist/error.js +8 -10
  33. package/dist/file.d.ts +50 -171
  34. package/dist/file.js +33 -115
  35. package/dist/filesystem.d.ts +10 -62
  36. package/dist/filesystem.js +5 -6
  37. package/dist/mixins/async.d.ts +4 -6
  38. package/dist/mixins/async.js +3 -1
  39. package/dist/mixins/mutexed.d.ts +4 -4
  40. package/dist/mixins/mutexed.js +7 -5
  41. package/dist/mixins/readonly.js +14 -15
  42. package/dist/mixins/shared.d.ts +5 -5
  43. package/dist/mixins/sync.d.ts +2 -2
  44. package/dist/stats.d.ts +21 -37
  45. package/dist/stats.js +9 -21
  46. package/dist/utils.d.ts +1 -3
  47. package/package.json +4 -4
  48. package/src/backends/backend.ts +7 -11
  49. package/src/backends/fetch.ts +2 -4
  50. package/src/backends/memory.ts +1 -1
  51. package/src/backends/overlay.ts +8 -6
  52. package/src/backends/port/fs.ts +11 -14
  53. package/src/backends/port/rpc.ts +1 -0
  54. package/src/backends/store/fs.ts +30 -46
  55. package/src/backends/store/simple.ts +1 -1
  56. package/src/backends/store/store.ts +7 -13
  57. package/src/config.ts +26 -26
  58. package/src/emulation/async.ts +28 -178
  59. package/src/emulation/path.ts +4 -11
  60. package/src/emulation/promises.ts +34 -116
  61. package/src/emulation/shared.ts +8 -6
  62. package/src/emulation/sync.ts +41 -185
  63. package/src/error.ts +7 -11
  64. package/src/file.ts +47 -180
  65. package/src/filesystem.ts +14 -65
  66. package/src/mixins/async.ts +4 -6
  67. package/src/mixins/mutexed.ts +4 -4
  68. package/src/mixins/readonly.ts +15 -15
  69. package/src/mixins/shared.ts +5 -5
  70. package/src/mixins/sync.ts +3 -3
  71. package/src/stats.ts +21 -38
@@ -9,11 +9,7 @@ import { ReadStream, WriteStream } from './streams.js';
9
9
  import { FSWatcher, StatWatcher } from './watchers.js';
10
10
  const nop = () => { };
11
11
  /**
12
- * Asynchronous rename. No arguments other than a possible exception are given
13
- * to the completion callback.
14
- * @param oldPath
15
- * @param newPath
16
- * @param callback
12
+ * Asynchronous rename. No arguments other than a possible exception are given to the completion callback.
17
13
  */
18
14
  export function rename(oldPath, newPath, cb = nop) {
19
15
  promises
@@ -23,10 +19,8 @@ export function rename(oldPath, newPath, cb = nop) {
23
19
  }
24
20
  rename;
25
21
  /**
26
- * Test whether or not the given path exists by checking with the file system.
22
+ * Test whether or not `path` exists by checking with the file system.
27
23
  * Then call the callback argument with either true or false.
28
- * @param path
29
- * @param callback
30
24
  * @deprecated Use {@link stat} or {@link access} instead.
31
25
  */
32
26
  export function exists(path, cb = nop) {
@@ -61,11 +55,6 @@ export function truncate(path, cbLen = 0, cb = nop) {
61
55
  .catch(cb);
62
56
  }
63
57
  truncate;
64
- /**
65
- * Asynchronous `unlink`.
66
- * @param path
67
- * @param callback
68
- */
69
58
  export function unlink(path, cb = nop) {
70
59
  promises
71
60
  .unlink(path)
@@ -115,11 +104,6 @@ export function fstat(fd, options, cb = nop) {
115
104
  .catch(cb);
116
105
  }
117
106
  fstat;
118
- /**
119
- * Asynchronous close.
120
- * @param fd
121
- * @param callback
122
- */
123
107
  export function close(fd, cb = nop) {
124
108
  new promises.FileHandle(fd)
125
109
  .close()
@@ -139,11 +123,6 @@ export function ftruncate(fd, lenOrCB, cb = nop) {
139
123
  .catch(cb);
140
124
  }
141
125
  ftruncate;
142
- /**
143
- * Asynchronous fsync.
144
- * @param fd
145
- * @param callback
146
- */
147
126
  export function fsync(fd, cb = nop) {
148
127
  fd2file(fd)
149
128
  .sync()
@@ -151,11 +130,6 @@ export function fsync(fd, cb = nop) {
151
130
  .catch(cb);
152
131
  }
153
132
  fsync;
154
- /**
155
- * Asynchronous fdatasync.
156
- * @param fd
157
- * @param callback
158
- */
159
133
  export function fdatasync(fd, cb = nop) {
160
134
  fd2file(fd)
161
135
  .datasync()
@@ -211,15 +185,12 @@ export function write(fd, data, cbPosOff, cbLenEnc, cbPosEnc, cb = nop) {
211
185
  write;
212
186
  /**
213
187
  * Read data from the file specified by `fd`.
214
- * @param buffer The buffer that the data will be
215
- * written to.
216
- * @param offset The offset within the buffer where writing will
217
- * start.
188
+ * @param buffer The buffer that the data will be written to.
189
+ * @param offset The offset within the buffer where writing will start.
218
190
  * @param length An integer specifying the number of bytes to read.
219
- * @param position An integer specifying where to begin reading from
220
- * in the file. If position is null, data will be read from the current file
221
- * position.
222
- * @param callback The number is the number of bytes read
191
+ * @param position An integer specifying where to begin reading from in the file.
192
+ * If position is null, data will be read from the current file position.
193
+ * @param cb The number is the number of bytes read
223
194
  */
224
195
  export function read(fd, buffer, offset, length, position, cb = nop) {
225
196
  new promises.FileHandle(fd)
@@ -228,13 +199,6 @@ export function read(fd, buffer, offset, length, position, cb = nop) {
228
199
  .catch(cb);
229
200
  }
230
201
  read;
231
- /**
232
- * Asynchronous `fchown`.
233
- * @param fd
234
- * @param uid
235
- * @param gid
236
- * @param callback
237
- */
238
202
  export function fchown(fd, uid, gid, cb = nop) {
239
203
  new promises.FileHandle(fd)
240
204
  .chown(uid, gid)
@@ -242,12 +206,6 @@ export function fchown(fd, uid, gid, cb = nop) {
242
206
  .catch(cb);
243
207
  }
244
208
  fchown;
245
- /**
246
- * Asynchronous `fchmod`.
247
- * @param fd
248
- * @param mode
249
- * @param callback
250
- */
251
209
  export function fchmod(fd, mode, cb) {
252
210
  new promises.FileHandle(fd)
253
211
  .chmod(mode)
@@ -256,12 +214,7 @@ export function fchmod(fd, mode, cb) {
256
214
  }
257
215
  fchmod;
258
216
  /**
259
- * Change the file timestamps of a file referenced by the supplied file
260
- * descriptor.
261
- * @param fd
262
- * @param atime
263
- * @param mtime
264
- * @param callback
217
+ * Change the file timestamps of a file referenced by the supplied file descriptor.
265
218
  */
266
219
  export function futimes(fd, atime, mtime, cb = nop) {
267
220
  new promises.FileHandle(fd)
@@ -270,11 +223,6 @@ export function futimes(fd, atime, mtime, cb = nop) {
270
223
  .catch(cb);
271
224
  }
272
225
  futimes;
273
- /**
274
- * Asynchronous `rmdir`.
275
- * @param path
276
- * @param callback
277
- */
278
226
  export function rmdir(path, cb = nop) {
279
227
  promises
280
228
  .rmdir(path)
@@ -284,9 +232,7 @@ export function rmdir(path, cb = nop) {
284
232
  rmdir;
285
233
  /**
286
234
  * Asynchronous `mkdir`.
287
- * @param path
288
235
  * @param mode defaults to `0777`
289
- * @param callback
290
236
  */
291
237
  export function mkdir(path, mode, cb = nop) {
292
238
  promises
@@ -304,12 +250,6 @@ export function readdir(path, _options, cb = nop) {
304
250
  .catch(cb);
305
251
  }
306
252
  readdir;
307
- /**
308
- * Asynchronous `link`.
309
- * @param existing
310
- * @param newpath
311
- * @param callback
312
- */
313
253
  export function link(existing, newpath, cb = nop) {
314
254
  promises
315
255
  .link(existing, newpath)
@@ -334,13 +274,6 @@ export function readlink(path, options, callback = nop) {
334
274
  .catch(callback);
335
275
  }
336
276
  readlink;
337
- /**
338
- * Asynchronous `chown`.
339
- * @param path
340
- * @param uid
341
- * @param gid
342
- * @param callback
343
- */
344
277
  export function chown(path, uid, gid, cb = nop) {
345
278
  promises
346
279
  .chown(path, uid, gid)
@@ -348,13 +281,6 @@ export function chown(path, uid, gid, cb = nop) {
348
281
  .catch(cb);
349
282
  }
350
283
  chown;
351
- /**
352
- * Asynchronous `lchown`.
353
- * @param path
354
- * @param uid
355
- * @param gid
356
- * @param callback
357
- */
358
284
  export function lchown(path, uid, gid, cb = nop) {
359
285
  promises
360
286
  .lchown(path, uid, gid)
@@ -362,12 +288,6 @@ export function lchown(path, uid, gid, cb = nop) {
362
288
  .catch(cb);
363
289
  }
364
290
  lchown;
365
- /**
366
- * Asynchronous `chmod`.
367
- * @param path
368
- * @param mode
369
- * @param callback
370
- */
371
291
  export function chmod(path, mode, cb = nop) {
372
292
  promises
373
293
  .chmod(path, mode)
@@ -375,12 +295,6 @@ export function chmod(path, mode, cb = nop) {
375
295
  .catch(cb);
376
296
  }
377
297
  chmod;
378
- /**
379
- * Asynchronous `lchmod`.
380
- * @param path
381
- * @param mode
382
- * @param callback
383
- */
384
298
  export function lchmod(path, mode, cb = nop) {
385
299
  promises
386
300
  .lchmod(path, mode)
@@ -390,10 +304,6 @@ export function lchmod(path, mode, cb = nop) {
390
304
  lchmod;
391
305
  /**
392
306
  * Change file timestamps of the file referenced by the supplied path.
393
- * @param path
394
- * @param atime
395
- * @param mtime
396
- * @param callback
397
307
  */
398
308
  export function utimes(path, atime, mtime, cb = nop) {
399
309
  promises
@@ -404,10 +314,6 @@ export function utimes(path, atime, mtime, cb = nop) {
404
314
  utimes;
405
315
  /**
406
316
  * Change file timestamps of the file referenced by the supplied path.
407
- * @param path
408
- * @param atime
409
- * @param mtime
410
- * @param callback
411
317
  */
412
318
  export function lutimes(path, atime, mtime, cb = nop) {
413
319
  promises
@@ -434,11 +340,11 @@ export function access(path, cbMode, cb = nop) {
434
340
  }
435
341
  access;
436
342
  const statWatchers = new Map();
437
- export function watchFile(path, optsListener, listener) {
343
+ export function watchFile(path, options, listener) {
438
344
  const normalizedPath = normalizePath(path.toString());
439
- const options = typeof optsListener != 'function' ? optsListener : {};
440
- if (typeof optsListener === 'function') {
441
- listener = optsListener;
345
+ const opts = typeof options != 'function' ? options : {};
346
+ if (typeof options == 'function') {
347
+ listener = options;
442
348
  }
443
349
  if (!listener) {
444
350
  throw new ErrnoError(Errno.EINVAL, 'No listener specified', path.toString(), 'watchFile');
@@ -450,7 +356,7 @@ export function watchFile(path, optsListener, listener) {
450
356
  }
451
357
  return;
452
358
  }
453
- const watcher = new StatWatcher(normalizedPath, options);
359
+ const watcher = new StatWatcher(normalizedPath, opts);
454
360
  watcher.on('change', (curr, prev) => {
455
361
  const entry = statWatchers.get(normalizedPath);
456
362
  if (!entry) {
@@ -505,8 +411,8 @@ watch;
505
411
  * @param options Options for the ReadStream and file opening (e.g., `encoding`, `highWaterMark`, `mode`).
506
412
  * @returns A ReadStream object for interacting with the file's contents.
507
413
  */
508
- export function createReadStream(path, _options) {
509
- const options = typeof _options == 'object' ? _options : { encoding: _options };
414
+ export function createReadStream(path, options) {
415
+ options = typeof options == 'object' ? options : { encoding: options };
510
416
  let handle;
511
417
  const stream = new ReadStream({
512
418
  highWaterMark: options.highWaterMark || 64 * 1024,
@@ -544,8 +450,8 @@ createReadStream;
544
450
  * @param options Options for the WriteStream and file opening (e.g., `encoding`, `highWaterMark`, `mode`).
545
451
  * @returns A WriteStream object for writing to the file.
546
452
  */
547
- export function createWriteStream(path, _options) {
548
- const options = typeof _options == 'object' ? _options : { encoding: _options };
453
+ export function createWriteStream(path, options) {
454
+ options = typeof options == 'object' ? options : { encoding: options };
549
455
  let handle;
550
456
  const stream = new WriteStream({
551
457
  highWaterMark: options?.highWaterMark,
@@ -1,4 +1,3 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
1
  import type { Dir as _Dir, Dirent as _Dirent } from 'fs';
3
2
  import type { Stats } from '../stats.js';
4
3
  import type { Callback } from '../utils.js';
@@ -1,8 +1,4 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
1
  import type { ParsedPath } from 'node:path';
3
- /**
4
- * An absolute path
5
- */
6
2
  export type AbsolutePath = `/${string}`;
7
3
  export declare let cwd: string;
8
4
  export declare function cd(path: string): void;
@@ -265,14 +265,12 @@ export function basename(path, suffix) {
265
265
  // Try to match the explicit extension
266
266
  if (path[i] === suffix[extIdx]) {
267
267
  if (--extIdx === -1) {
268
- // We matched the extension, so mark this as the end of our path
269
- // component
268
+ // We matched the extension, so mark this as the end of our path component
270
269
  end = i;
271
270
  }
272
271
  }
273
272
  else {
274
- // Extension does not match, so our result is the entire path
275
- // component
273
+ // Extension does not match, so our result is the entire path component
276
274
  extIdx = -1;
277
275
  end = firstNonSlashEnd;
278
276
  }
@@ -287,16 +285,14 @@ export function basename(path, suffix) {
287
285
  }
288
286
  for (let i = path.length - 1; i >= 0; --i) {
289
287
  if (path[i] === '/') {
290
- // If we reached a path separator that was not part of a set of path
291
- // separators at the end of the string, stop now
288
+ // If we reached a path separator that was not part of a set of path separators at the end of the string, stop now
292
289
  if (!matchedSlash) {
293
290
  start = i + 1;
294
291
  break;
295
292
  }
296
293
  }
297
294
  else if (end === -1) {
298
- // We saw the first non-path separator, mark this as the end of our
299
- // path component
295
+ // We saw the first non-path separator, mark this as the end of our path component
300
296
  matchedSlash = false;
301
297
  end = i + 1;
302
298
  }
@@ -1,11 +1,3 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
- /// <reference types="node" resolution-mode="require"/>
3
- /// <reference types="node" resolution-mode="require"/>
4
- /// <reference types="node" resolution-mode="require"/>
5
- /// <reference types="node" resolution-mode="require"/>
6
- /// <reference types="node" resolution-mode="require"/>
7
- /// <reference types="node" resolution-mode="require"/>
8
- /// <reference types="node" resolution-mode="require"/>
9
1
  import { Buffer } from 'buffer';
10
2
  import type * as fs from 'node:fs';
11
3
  import type * as promises from 'node:fs/promises';
@@ -50,9 +42,9 @@ export declare class FileHandle implements promises.FileHandle {
50
42
  sync(): Promise<void>;
51
43
  /**
52
44
  * Asynchronous ftruncate(2) - Truncate a file to a specified length.
53
- * @param len If not specified, defaults to `0`.
45
+ * @param length If not specified, defaults to `0`.
54
46
  */
55
- truncate(len?: number | null): Promise<void>;
47
+ truncate(length?: number | null): Promise<void>;
56
48
  /**
57
49
  * Asynchronously change file timestamps of the file.
58
50
  * @param atime The last access time. If a string is provided, it will be coerced to number.
@@ -64,10 +56,9 @@ export declare class FileHandle implements promises.FileHandle {
64
56
  * The `FileHandle` must have been opened for appending.
65
57
  * @param data The data to write. If something other than a `Buffer` or `Uint8Array` is provided, the value is coerced to a string.
66
58
  * @param _options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag.
67
- * If `encoding` is not supplied, the default of `'utf8'` is used.
68
- * If `mode` is not supplied, the default of `0o666` is used.
69
- * If `mode` is a string, it is parsed as an octal integer.
70
- * If `flag` is not supplied, the default of `'a'` is used.
59
+ * - `encoding` defaults to `'utf8'`.
60
+ * - `mode` defaults to `0o666`.
61
+ * - `flag` defaults to `'a'`.
71
62
  */
72
63
  appendFile(data: string | Uint8Array, _options?: (fs.ObjectEncodingOptions & FlagAndOpenMode) | BufferEncoding): Promise<void>;
73
64
  /**
@@ -92,10 +83,11 @@ export declare class FileHandle implements promises.FileHandle {
92
83
  /**
93
84
  * Returns a `ReadableStream` that may be used to read the files data.
94
85
  *
95
- * An error will be thrown if this method is called more than once or is called after the `FileHandle` is closed
96
- * or closing.
86
+ * An error will be thrown if this method is called more than once or is called after the `FileHandle` is closed or closing.
97
87
  *
98
- * While the `ReadableStream` will read the file to completion, it will not close the `FileHandle` automatically. User code must still call the `fileHandle.close()` method.
88
+ * While the `ReadableStream` will read the file to completion,
89
+ * it will not close the `FileHandle` automatically.
90
+ * User code must still call the `fileHandle.close()` method.
99
91
  *
100
92
  * @since v17.0.0
101
93
  * @experimental
@@ -134,10 +126,9 @@ export declare class FileHandle implements promises.FileHandle {
134
126
  * It is unsafe to call `writeFile()` multiple times on the same file without waiting for the `Promise` to be resolved (or rejected).
135
127
  * @param data The data to write. If something other than a `Buffer` or `Uint8Array` is provided, the value is coerced to a string.
136
128
  * @param _options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag.
137
- * If `encoding` is not supplied, the default of `'utf8'` is used.
138
- * If `mode` is not supplied, the default of `0o666` is used.
139
- * If `mode` is a string, it is parsed as an octal integer.
140
- * If `flag` is not supplied, the default of `'w'` is used.
129
+ * - `encoding` defaults to `'utf8'`.
130
+ * - `mode` defaults to `0o666`.
131
+ * - `flag` defaults to `'w'`.
141
132
  */
142
133
  writeFile(data: string | Uint8Array, _options?: fs.WriteFileOptions): Promise<void>;
143
134
  /**
@@ -159,36 +150,21 @@ export declare class FileHandle implements promises.FileHandle {
159
150
  */
160
151
  readv(buffers: NodeJS.ArrayBufferView[], position?: number): Promise<fs.ReadVResult>;
161
152
  /**
162
- * Creates a `ReadStream` for reading from the file.
163
- *
153
+ * Creates a stream for reading from the file.
164
154
  * @param options Options for the readable stream
165
- * @returns A `ReadStream` object.
166
155
  */
167
156
  createReadStream(options?: CreateReadStreamOptions): ReadStream;
168
157
  /**
169
- * Creates a `WriteStream` for writing to the file.
170
- *
158
+ * Creates a stream for writing to the file.
171
159
  * @param options Options for the writeable stream.
172
- * @returns A `WriteStream` object
173
160
  */
174
161
  createWriteStream(options?: CreateWriteStreamOptions): WriteStream;
175
162
  }
176
- /**
177
- * Renames a file
178
- * @param oldPath
179
- * @param newPath
180
- */
181
163
  export declare function rename(oldPath: fs.PathLike, newPath: fs.PathLike): Promise<void>;
182
164
  /**
183
- * Test whether or not the given path exists by checking with the file system.
184
- * @param path
165
+ * Test whether or not `path` exists by checking with the file system.
185
166
  */
186
167
  export declare function exists(path: fs.PathLike): Promise<boolean>;
187
- /**
188
- * `stat`.
189
- * @param path
190
- * @returns Stats
191
- */
192
168
  export declare function stat(path: fs.PathLike, options: fs.BigIntOptions): Promise<BigIntStats>;
193
169
  export declare function stat(path: fs.PathLike, options?: {
194
170
  bigint?: false;
@@ -198,8 +174,6 @@ export declare function stat(path: fs.PathLike, options?: fs.StatOptions): Promi
198
174
  * `lstat`.
199
175
  * `lstat()` is identical to `stat()`, except that if path is a symbolic link,
200
176
  * then the link itself is stat-ed, not the file that it refers to.
201
- * @param path
202
- * @return
203
177
  */
204
178
  export declare function lstat(path: fs.PathLike, options?: {
205
179
  bigint?: boolean;
@@ -207,31 +181,20 @@ export declare function lstat(path: fs.PathLike, options?: {
207
181
  export declare function lstat(path: fs.PathLike, options: {
208
182
  bigint: true;
209
183
  }): Promise<BigIntStats>;
210
- /**
211
- * `truncate`.
212
- * @param path
213
- * @param len
214
- */
215
184
  export declare function truncate(path: fs.PathLike, len?: number): Promise<void>;
216
- /**
217
- * `unlink`.
218
- * @param path
219
- */
220
185
  export declare function unlink(path: fs.PathLike): Promise<void>;
221
186
  /**
222
187
  * Asynchronous file open.
223
188
  * @see http://www.manpagez.com/man/2/open/
224
- * @param flags Handles the complexity of the various file modes. See its API for more details.
189
+ * @param flag Handles the complexity of the various file modes. See its API for more details.
225
190
  * @param mode Mode to use to open the file. Can be ignored if the filesystem doesn't support permissions.
226
191
  */
227
192
  export declare function open(path: fs.PathLike, flag?: fs.OpenMode, mode?: fs.Mode): Promise<FileHandle>;
228
193
  /**
229
194
  * Asynchronously reads the entire contents of a file.
230
- * @param filename
231
- * @param options
232
- * options.encoding The string encoding for the file contents. Defaults to `null`.
233
- * options.flag Defaults to `'r'`.
234
- * @returns file data
195
+ * @option encoding The string encoding for the file contents. Defaults to `null`.
196
+ * @option flag Defaults to `'r'`.
197
+ * @returns the file data
235
198
  */
236
199
  export declare function readFile(path: fs.PathLike | promises.FileHandle, options?: {
237
200
  encoding?: null;
@@ -248,12 +211,9 @@ export declare function readFile(path: fs.PathLike | promises.FileHandle, option
248
211
  * Asynchronously writes data to a file, replacing the file if it already exists.
249
212
  *
250
213
  * The encoding option is ignored if data is a buffer.
251
- * @param path
252
- * @param data Note:
253
- * @param _options
254
- * @option options encoding Defaults to `'utf8'`.
255
- * @option options mode Defaults to `0644`.
256
- * @option options flag Defaults to `'w'`.
214
+ * @option encoding Defaults to `'utf8'`.
215
+ * @option mode Defaults to `0644`.
216
+ * @option flag Defaults to `'w'`.
257
217
  */
258
218
  export declare function writeFile(path: fs.PathLike | promises.FileHandle, data: FileContents | Stream | Iterable<string | ArrayBufferView> | AsyncIterable<string | ArrayBufferView>, _options?: (fs.ObjectEncodingOptions & {
259
219
  mode?: fs.Mode;
@@ -261,23 +221,15 @@ export declare function writeFile(path: fs.PathLike | promises.FileHandle, data:
261
221
  flush?: boolean;
262
222
  }) | BufferEncoding | null): Promise<void>;
263
223
  /**
264
- * Asynchronously append data to a file, creating the file if it not yet
265
- * exists.
266
- * @param path
267
- * @param data
268
- * @param options
269
- * @option options encoding Defaults to `'utf8'`.
270
- * @option options mode Defaults to `0644`.
271
- * @option options flag Defaults to `'a'`.
224
+ * Asynchronously append data to a file, creating the file if it not yet exists.
225
+ * @option encoding Defaults to `'utf8'`.
226
+ * @option mode Defaults to `0644`.
227
+ * @option flag Defaults to `'a'`.
272
228
  */
273
229
  export declare function appendFile(path: fs.PathLike | promises.FileHandle, data: FileContents, _options?: BufferEncoding | (fs.EncodingOption & {
274
230
  mode?: fs.Mode;
275
231
  flag?: fs.OpenMode;
276
232
  }) | null): Promise<void>;
277
- /**
278
- * `rmdir`.
279
- * @param path
280
- */
281
233
  export declare function rmdir(path: fs.PathLike): Promise<void>;
282
234
  /**
283
235
  * Asynchronous mkdir(2) - create a directory.
@@ -295,7 +247,7 @@ export declare function mkdir(path: fs.PathLike, options?: fs.Mode | fs.MakeDire
295
247
  /**
296
248
  * Asynchronous readdir(3) - read a directory.
297
249
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
298
- * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
250
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'`.
299
251
  */
300
252
  export declare function readdir(path: fs.PathLike, options?: (fs.ObjectEncodingOptions & {
301
253
  withFileTypes?: false;
@@ -313,11 +265,6 @@ export declare function readdir(path: fs.PathLike, options: fs.ObjectEncodingOpt
313
265
  withFileTypes: true;
314
266
  recursive?: boolean;
315
267
  }): Promise<Dirent[]>;
316
- /**
317
- * `link`.
318
- * @param targetPath
319
- * @param linkPath
320
- */
321
268
  export declare function link(targetPath: fs.PathLike, linkPath: fs.PathLike): Promise<void>;
322
269
  /**
323
270
  * `symlink`.
@@ -326,68 +273,31 @@ export declare function link(targetPath: fs.PathLike, linkPath: fs.PathLike): Pr
326
273
  * @param type can be either `'dir'` or `'file'` (default is `'file'`)
327
274
  */
328
275
  export declare function symlink(target: fs.PathLike, path: fs.PathLike, type?: fs.symlink.Type | string | null): Promise<void>;
329
- /**
330
- * readlink.
331
- * @param path
332
- */
333
276
  export declare function readlink(path: fs.PathLike, options: fs.BufferEncodingOption): Promise<Buffer>;
334
277
  export declare function readlink(path: fs.PathLike, options?: fs.EncodingOption | null): Promise<string>;
335
278
  export declare function readlink(path: fs.PathLike, options?: fs.BufferEncodingOption | fs.EncodingOption | string | null): Promise<string | Buffer>;
336
- /**
337
- * `chown`.
338
- * @param path
339
- * @param uid
340
- * @param gid
341
- */
342
279
  export declare function chown(path: fs.PathLike, uid: number, gid: number): Promise<void>;
343
- /**
344
- * `lchown`.
345
- * @param path
346
- * @param uid
347
- * @param gid
348
- */
349
280
  export declare function lchown(path: fs.PathLike, uid: number, gid: number): Promise<void>;
350
- /**
351
- * `chmod`.
352
- * @param path
353
- * @param mode
354
- */
355
281
  export declare function chmod(path: fs.PathLike, mode: fs.Mode): Promise<void>;
356
- /**
357
- * `lchmod`.
358
- * @param path
359
- * @param mode
360
- */
361
282
  export declare function lchmod(path: fs.PathLike, mode: fs.Mode): Promise<void>;
362
283
  /**
363
284
  * Change file timestamps of the file referenced by the supplied path.
364
- * @param path
365
- * @param atime
366
- * @param mtime
367
285
  */
368
286
  export declare function utimes(path: fs.PathLike, atime: string | number | Date, mtime: string | number | Date): Promise<void>;
369
287
  /**
370
288
  * Change file timestamps of the file referenced by the supplied path.
371
- * @param path
372
- * @param atime
373
- * @param mtime
374
289
  */
375
290
  export declare function lutimes(path: fs.PathLike, atime: fs.TimeLike, mtime: fs.TimeLike): Promise<void>;
376
291
  /**
377
292
  * Asynchronous realpath(3) - return the canonicalized absolute pathname.
378
293
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
379
- * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
294
+ * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. Defaults to `'utf8'`.
380
295
  */
381
296
  export declare function realpath(path: fs.PathLike, options: fs.BufferEncodingOption): Promise<Buffer>;
382
297
  export declare function realpath(path: fs.PathLike, options?: fs.EncodingOption | BufferEncoding): Promise<string>;
383
298
  export declare function watch(filename: fs.PathLike, options?: fs.WatchOptions | BufferEncoding): AsyncIterable<FileChangeInfo<string>>;
384
299
  export declare function watch(filename: fs.PathLike, options: fs.WatchOptions | fs.BufferEncodingOption): AsyncIterable<FileChangeInfo<Buffer>>;
385
300
  export declare function watch(filename: fs.PathLike, options?: fs.WatchOptions | string): AsyncIterable<FileChangeInfo<string>> | AsyncIterable<FileChangeInfo<Buffer>>;
386
- /**
387
- * `access`.
388
- * @param path
389
- * @param mode
390
- */
391
301
  export declare function access(path: fs.PathLike, mode?: number): Promise<void>;
392
302
  /**
393
303
  * Asynchronous `rm`. Removes files or directories (recursively).
@@ -425,15 +335,15 @@ export declare function opendir(path: fs.PathLike, options?: fs.OpenDirOptions):
425
335
  * @param opts Options for the copy operation. Currently supports these options from Node.js 'fs.await cp':
426
336
  * * `dereference`: Dereference symbolic links.
427
337
  * * `errorOnExist`: Throw an error if the destination file or directory already exists.
428
- * * `filter`: A function that takes a source and destination path and returns a boolean, indicating whether to copy the given source element.
338
+ * * `filter`: A function that takes a source and destination path and returns a boolean, indicating whether to copy `source` element.
429
339
  * * `force`: Overwrite the destination if it exists, and overwrite existing readonly destination files.
430
340
  * * `preserveTimestamps`: Preserve file timestamps.
431
341
  * * `recursive`: If `true`, copies directories recursively.
432
342
  */
433
343
  export declare function cp(source: fs.PathLike, destination: fs.PathLike, opts?: fs.CopyOptions): Promise<void>;
434
344
  /**
435
- * @since v18.15.0
436
- * @return Fulfills with an {fs.StatFs} for the file system.
345
+ * @since Node v18.15.0
346
+ * @returns Fulfills with an {fs.StatFs} for the file system.
437
347
  */
438
348
  export declare function statfs(path: fs.PathLike, opts?: fs.StatFsOptions & {
439
349
  bigint?: false;