@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.
Files changed (56) hide show
  1. package/dist/ApiError.d.ts +4 -3
  2. package/dist/ApiError.js +1 -1
  3. package/dist/backends/AsyncStore.d.ts +3 -2
  4. package/dist/backends/AsyncStore.js +12 -5
  5. package/dist/backends/InMemory.d.ts +1 -1
  6. package/dist/backends/Index.d.ts +7 -10
  7. package/dist/backends/Index.js +7 -5
  8. package/dist/backends/Overlay.js +1 -1
  9. package/dist/backends/SyncStore.d.ts +6 -6
  10. package/dist/backends/SyncStore.js +4 -4
  11. package/dist/backends/backend.d.ts +5 -4
  12. package/dist/backends/backend.js +2 -2
  13. package/dist/browser.min.js +4 -4
  14. package/dist/browser.min.js.map +3 -3
  15. package/dist/config.d.ts +1 -1
  16. package/dist/config.js +2 -2
  17. package/dist/emulation/async.d.ts +76 -77
  18. package/dist/emulation/async.js +42 -42
  19. package/dist/emulation/dir.js +6 -5
  20. package/dist/emulation/promises.d.ts +106 -102
  21. package/dist/emulation/promises.js +61 -65
  22. package/dist/emulation/shared.d.ts +1 -7
  23. package/dist/emulation/shared.js +1 -1
  24. package/dist/emulation/streams.js +3 -2
  25. package/dist/emulation/sync.d.ts +71 -64
  26. package/dist/emulation/sync.js +39 -40
  27. package/dist/file.d.ts +4 -4
  28. package/dist/file.js +7 -5
  29. package/dist/filesystem.d.ts +1 -1
  30. package/dist/filesystem.js +3 -0
  31. package/dist/mutex.js +2 -2
  32. package/dist/stats.d.ts +7 -7
  33. package/dist/stats.js +50 -10
  34. package/dist/utils.d.ts +5 -5
  35. package/dist/utils.js +4 -3
  36. package/package.json +3 -3
  37. package/readme.md +2 -2
  38. package/src/ApiError.ts +3 -1
  39. package/src/backends/AsyncStore.ts +14 -8
  40. package/src/backends/Index.ts +14 -10
  41. package/src/backends/Overlay.ts +3 -3
  42. package/src/backends/SyncStore.ts +8 -8
  43. package/src/backends/backend.ts +7 -5
  44. package/src/config.ts +5 -5
  45. package/src/emulation/async.ts +188 -196
  46. package/src/emulation/dir.ts +6 -6
  47. package/src/emulation/promises.ts +181 -173
  48. package/src/emulation/shared.ts +2 -9
  49. package/src/emulation/streams.ts +9 -8
  50. package/src/emulation/sync.ts +159 -159
  51. package/src/file.ts +11 -9
  52. package/src/filesystem.ts +11 -7
  53. package/src/mutex.ts +3 -3
  54. package/src/stats.ts +32 -23
  55. package/src/utils.ts +10 -9
  56. package/tsconfig.json +2 -1
package/dist/config.d.ts CHANGED
@@ -3,7 +3,7 @@ import { FileSystem } from './filesystem.js';
3
3
  /**
4
4
  * Configuration for a specific mount point
5
5
  */
6
- export type MountConfiguration<FS extends FileSystem = FileSystem, TOptions extends object = object> = FS | BackendConfiguration<FS, TOptions> | Backend<FS, TOptions>;
6
+ export type MountConfiguration<FS extends FileSystem = FileSystem, TOptions extends object = object> = FS | BackendConfiguration<Backend<FS, TOptions>> | Backend<FS, TOptions>;
7
7
  /**
8
8
  * Retrieve a file system with the given configuration.
9
9
  * @param config A BackendConfig object.
package/dist/config.js CHANGED
@@ -49,8 +49,8 @@ export async function resolveMountConfig(config, _depth = 0) {
49
49
  * @see Configuration for more info on the configuration object.
50
50
  */
51
51
  export async function configure(config) {
52
- const uid = 'uid' in config ? +config.uid || 0 : 0;
53
- const gid = 'gid' in config ? +config.gid || 0 : 0;
52
+ const uid = 'uid' in config ? config.uid || 0 : 0;
53
+ const gid = 'gid' in config ? config.gid || 0 : 0;
54
54
  if (isMountConfig(config)) {
55
55
  // single FS
56
56
  config = { '/': config };
@@ -1,13 +1,12 @@
1
1
  /// <reference types="node" resolution-mode="require"/>
2
2
  /// <reference types="node" resolution-mode="require"/>
3
3
  /// <reference types="node" resolution-mode="require"/>
4
- import type * as Node from 'fs';
4
+ import type * as fs from 'node:fs';
5
5
  import type { FileContents } from '../filesystem.js';
6
6
  import { BigIntStats, type BigIntStatsFs, type Stats, type StatsFs } from '../stats.js';
7
7
  import { type Callback } from '../utils.js';
8
8
  import { Dirent, type Dir } from './dir.js';
9
9
  import * as promises from './promises.js';
10
- import { PathLike } from './shared.js';
11
10
  import { ReadStream, WriteStream } from './streams.js';
12
11
  /**
13
12
  * Asynchronous rename. No arguments other than a possible exception are given
@@ -16,7 +15,7 @@ import { ReadStream, WriteStream } from './streams.js';
16
15
  * @param newPath
17
16
  * @param callback
18
17
  */
19
- export declare function rename(oldPath: PathLike, newPath: PathLike, cb?: Callback): void;
18
+ export declare function rename(oldPath: fs.PathLike, newPath: fs.PathLike, cb?: Callback): void;
20
19
  /**
21
20
  * Test whether or not the given path exists by checking with the file system.
22
21
  * Then call the callback argument with either true or false.
@@ -24,20 +23,20 @@ export declare function rename(oldPath: PathLike, newPath: PathLike, cb?: Callba
24
23
  * @param callback
25
24
  * @deprecated Use {@link stat} or {@link access} instead.
26
25
  */
27
- export declare function exists(path: PathLike, cb?: (exists: boolean) => unknown): void;
26
+ export declare function exists(path: fs.PathLike, cb?: (exists: boolean) => unknown): void;
28
27
  /**
29
28
  * Asynchronous `stat`.
30
29
  * @param path
31
30
  * @param callback
32
31
  */
33
- export declare function stat(path: PathLike, callback: Callback<[Stats]>): void;
34
- export declare function stat(path: PathLike, options: {
32
+ export declare function stat(path: fs.PathLike, callback: Callback<[Stats]>): void;
33
+ export declare function stat(path: fs.PathLike, options: {
35
34
  bigint?: false;
36
35
  }, callback: Callback<[Stats]>): void;
37
- export declare function stat(path: PathLike, options: {
36
+ export declare function stat(path: fs.PathLike, options: {
38
37
  bigint: true;
39
38
  }, callback: Callback<[BigIntStats]>): void;
40
- export declare function stat(path: PathLike, options: Node.StatOptions, callback: Callback<[Stats] | [BigIntStats]>): void;
39
+ export declare function stat(path: fs.PathLike, options: fs.StatOptions, callback: Callback<[Stats] | [BigIntStats]>): void;
41
40
  /**
42
41
  * Asynchronous `lstat`.
43
42
  * `lstat()` is identical to `stat()`, except that if path is a symbolic link,
@@ -45,28 +44,28 @@ export declare function stat(path: PathLike, options: Node.StatOptions, callback
45
44
  * @param path
46
45
  * @param callback
47
46
  */
48
- export declare function lstat(path: PathLike, callback: Callback<[Stats]>): void;
49
- export declare function lstat(path: PathLike, options: Node.StatOptions & {
47
+ export declare function lstat(path: fs.PathLike, callback: Callback<[Stats]>): void;
48
+ export declare function lstat(path: fs.PathLike, options: fs.StatOptions & {
50
49
  bigint?: false;
51
50
  }, callback: Callback<[Stats]>): void;
52
- export declare function lstat(path: PathLike, options: Node.StatOptions & {
51
+ export declare function lstat(path: fs.PathLike, options: fs.StatOptions & {
53
52
  bigint: true;
54
53
  }, callback: Callback<[BigIntStats]>): void;
55
- export declare function lstat(path: PathLike, options: Node.StatOptions, callback: Callback<[Stats | BigIntStats]>): void;
54
+ export declare function lstat(path: fs.PathLike, options: fs.StatOptions, callback: Callback<[Stats | BigIntStats]>): void;
56
55
  /**
57
56
  * Asynchronous `truncate`.
58
57
  * @param path
59
58
  * @param len
60
59
  * @param callback
61
60
  */
62
- export declare function truncate(path: PathLike, cb?: Callback): void;
63
- export declare function truncate(path: PathLike, len: number, cb?: Callback): void;
61
+ export declare function truncate(path: fs.PathLike, cb?: Callback): void;
62
+ export declare function truncate(path: fs.PathLike, len: number, cb?: Callback): void;
64
63
  /**
65
64
  * Asynchronous `unlink`.
66
65
  * @param path
67
66
  * @param callback
68
67
  */
69
- export declare function unlink(path: PathLike, cb?: Callback): void;
68
+ export declare function unlink(path: fs.PathLike, cb?: Callback): void;
70
69
  /**
71
70
  * Asynchronous file open.
72
71
  * Exclusive mode ensures that path is newly created.
@@ -92,8 +91,8 @@ export declare function unlink(path: PathLike, cb?: Callback): void;
92
91
  * @param mode defaults to `0644`
93
92
  * @param callback
94
93
  */
95
- export declare function open(path: PathLike, flag: string, cb?: Callback<[number]>): void;
96
- export declare function open(path: PathLike, flag: string, mode: number | string, cb?: Callback<[number]>): void;
94
+ export declare function open(path: fs.PathLike, flag: string, cb?: Callback<[number]>): void;
95
+ export declare function open(path: fs.PathLike, flag: string, mode: number | string, cb?: Callback<[number]>): void;
97
96
  /**
98
97
  * Asynchronously reads the entire contents of a file.
99
98
  * @param filename
@@ -102,11 +101,11 @@ export declare function open(path: PathLike, flag: string, mode: number | string
102
101
  * @option options flag Defaults to `'r'`.
103
102
  * @param callback If no encoding is specified, then the raw buffer is returned.
104
103
  */
105
- export declare function readFile(filename: PathLike, cb: Callback<[Uint8Array]>): void;
106
- export declare function readFile(filename: PathLike, options: {
104
+ export declare function readFile(filename: fs.PathLike, cb: Callback<[Uint8Array]>): void;
105
+ export declare function readFile(filename: fs.PathLike, options: {
107
106
  flag?: string;
108
107
  }, callback?: Callback<[Uint8Array]>): void;
109
- export declare function readFile(filename: PathLike, options: {
108
+ export declare function readFile(filename: fs.PathLike, options: {
110
109
  encoding: BufferEncoding;
111
110
  flag?: string;
112
111
  } | BufferEncoding, cb: Callback<[string]>): void;
@@ -124,9 +123,9 @@ export declare function readFile(filename: PathLike, options: {
124
123
  * @option flag Defaults to `'w'`.
125
124
  * @param callback
126
125
  */
127
- export declare function writeFile(filename: PathLike, data: FileContents, cb?: Callback): void;
128
- export declare function writeFile(filename: PathLike, data: FileContents, encoding?: BufferEncoding, cb?: Callback): void;
129
- export declare function writeFile(filename: PathLike, data: FileContents, options?: Node.WriteFileOptions, cb?: Callback): void;
126
+ export declare function writeFile(filename: fs.PathLike, data: FileContents, cb?: Callback): void;
127
+ export declare function writeFile(filename: fs.PathLike, data: FileContents, encoding?: BufferEncoding, cb?: Callback): void;
128
+ export declare function writeFile(filename: fs.PathLike, data: FileContents, options?: fs.WriteFileOptions, cb?: Callback): void;
130
129
  /**
131
130
  * Asynchronously append data to a file, creating the file if it not yet
132
131
  * exists.
@@ -139,13 +138,13 @@ export declare function writeFile(filename: PathLike, data: FileContents, option
139
138
  * @option flag Defaults to `'a'`.
140
139
  * @param callback
141
140
  */
142
- export declare function appendFile(filename: PathLike, data: FileContents, cb?: Callback): void;
143
- export declare function appendFile(filename: PathLike, data: FileContents, options?: {
141
+ export declare function appendFile(filename: fs.PathLike, data: FileContents, cb?: Callback): void;
142
+ export declare function appendFile(filename: fs.PathLike, data: FileContents, options?: {
144
143
  encoding?: string;
145
144
  mode?: number | string;
146
145
  flag?: string;
147
146
  }, cb?: Callback): void;
148
- export declare function appendFile(filename: PathLike, data: FileContents, encoding?: string, cb?: Callback): void;
147
+ export declare function appendFile(filename: fs.PathLike, data: FileContents, encoding?: string, cb?: Callback): void;
149
148
  /**
150
149
  * Asynchronous `fstat`.
151
150
  * `fstat()` is identical to `stat()`, except that the file to be stat-ed is
@@ -154,10 +153,10 @@ export declare function appendFile(filename: PathLike, data: FileContents, encod
154
153
  * @param callback
155
154
  */
156
155
  export declare function fstat(fd: number, cb: Callback<[Stats]>): void;
157
- export declare function fstat(fd: number, options: Node.StatOptions & {
156
+ export declare function fstat(fd: number, options: fs.StatOptions & {
158
157
  bigint?: false;
159
158
  }, cb: Callback<[Stats]>): void;
160
- export declare function fstat(fd: number, options: Node.StatOptions & {
159
+ export declare function fstat(fd: number, options: fs.StatOptions & {
161
160
  bigint: true;
162
161
  }, cb: Callback<[BigIntStats]>): void;
163
162
  /**
@@ -247,14 +246,14 @@ export declare function futimes(fd: number, atime: number | Date, mtime: number
247
246
  * @param path
248
247
  * @param callback
249
248
  */
250
- export declare function rmdir(path: PathLike, cb?: Callback): void;
249
+ export declare function rmdir(path: fs.PathLike, cb?: Callback): void;
251
250
  /**
252
251
  * Asynchronous `mkdir`.
253
252
  * @param path
254
253
  * @param mode defaults to `0777`
255
254
  * @param callback
256
255
  */
257
- export declare function mkdir(path: PathLike, mode?: Node.Mode, cb?: Callback): void;
256
+ export declare function mkdir(path: fs.PathLike, mode?: fs.Mode, cb?: Callback): void;
258
257
  /**
259
258
  * Asynchronous `readdir`. Reads the contents of a directory.
260
259
  * The callback gets two arguments `(err, files)` where `files` is an array of
@@ -262,11 +261,11 @@ export declare function mkdir(path: PathLike, mode?: Node.Mode, cb?: Callback):
262
261
  * @param path
263
262
  * @param callback
264
263
  */
265
- export declare function readdir(path: PathLike, cb: Callback<[string[]]>): void;
266
- export declare function readdir(path: PathLike, options: {
264
+ export declare function readdir(path: fs.PathLike, cb: Callback<[string[]]>): void;
265
+ export declare function readdir(path: fs.PathLike, options: {
267
266
  withFileTypes?: false;
268
267
  }, cb: Callback<[string[]]>): void;
269
- export declare function readdir(path: PathLike, options: {
268
+ export declare function readdir(path: fs.PathLike, options: {
270
269
  withFileTypes: true;
271
270
  }, cb: Callback<[Dirent[]]>): void;
272
271
  /**
@@ -275,7 +274,7 @@ export declare function readdir(path: PathLike, options: {
275
274
  * @param newpath
276
275
  * @param callback
277
276
  */
278
- export declare function link(existing: PathLike, newpath: PathLike, cb?: Callback): void;
277
+ export declare function link(existing: fs.PathLike, newpath: fs.PathLike, cb?: Callback): void;
279
278
  /**
280
279
  * Asynchronous `symlink`.
281
280
  * @param target target path
@@ -283,17 +282,17 @@ export declare function link(existing: PathLike, newpath: PathLike, cb?: Callbac
283
282
  * @param type can be either `'dir'` or `'file'` (default is `'file'`)
284
283
  * @param callback
285
284
  */
286
- export declare function symlink(target: PathLike, path: PathLike, cb?: Callback): void;
287
- export declare function symlink(target: PathLike, path: PathLike, type?: Node.symlink.Type, cb?: Callback): void;
285
+ export declare function symlink(target: fs.PathLike, path: fs.PathLike, cb?: Callback): void;
286
+ export declare function symlink(target: fs.PathLike, path: fs.PathLike, type?: fs.symlink.Type, cb?: Callback): void;
288
287
  /**
289
288
  * Asynchronous readlink.
290
289
  * @param path
291
290
  * @param callback
292
291
  */
293
- export declare function readlink(path: PathLike, callback: Callback<[string]> & any): void;
294
- export declare function readlink(path: PathLike, options: Node.BufferEncodingOption, callback: Callback<[Uint8Array]>): void;
295
- export declare function readlink(path: PathLike, options: Node.EncodingOption, callback: Callback<[string | Uint8Array]>): void;
296
- export declare function readlink(path: PathLike, options: Node.EncodingOption, callback: Callback<[string]>): void;
292
+ export declare function readlink(path: fs.PathLike, callback: Callback<[string]> & any): void;
293
+ export declare function readlink(path: fs.PathLike, options: fs.BufferEncodingOption, callback: Callback<[Uint8Array]>): void;
294
+ export declare function readlink(path: fs.PathLike, options: fs.EncodingOption, callback: Callback<[string | Uint8Array]>): void;
295
+ export declare function readlink(path: fs.PathLike, options: fs.EncodingOption, callback: Callback<[string]>): void;
297
296
  /**
298
297
  * Asynchronous `chown`.
299
298
  * @param path
@@ -301,7 +300,7 @@ export declare function readlink(path: PathLike, options: Node.EncodingOption, c
301
300
  * @param gid
302
301
  * @param callback
303
302
  */
304
- export declare function chown(path: PathLike, uid: number, gid: number, cb?: Callback): void;
303
+ export declare function chown(path: fs.PathLike, uid: number, gid: number, cb?: Callback): void;
305
304
  /**
306
305
  * Asynchronous `lchown`.
307
306
  * @param path
@@ -309,21 +308,21 @@ export declare function chown(path: PathLike, uid: number, gid: number, cb?: Cal
309
308
  * @param gid
310
309
  * @param callback
311
310
  */
312
- export declare function lchown(path: PathLike, uid: number, gid: number, cb?: Callback): void;
311
+ export declare function lchown(path: fs.PathLike, uid: number, gid: number, cb?: Callback): void;
313
312
  /**
314
313
  * Asynchronous `chmod`.
315
314
  * @param path
316
315
  * @param mode
317
316
  * @param callback
318
317
  */
319
- export declare function chmod(path: PathLike, mode: number | string, cb?: Callback): void;
318
+ export declare function chmod(path: fs.PathLike, mode: number | string, cb?: Callback): void;
320
319
  /**
321
320
  * Asynchronous `lchmod`.
322
321
  * @param path
323
322
  * @param mode
324
323
  * @param callback
325
324
  */
326
- export declare function lchmod(path: PathLike, mode: number | string, cb?: Callback): void;
325
+ export declare function lchmod(path: fs.PathLike, mode: number | string, cb?: Callback): void;
327
326
  /**
328
327
  * Change file timestamps of the file referenced by the supplied path.
329
328
  * @param path
@@ -331,7 +330,7 @@ export declare function lchmod(path: PathLike, mode: number | string, cb?: Callb
331
330
  * @param mtime
332
331
  * @param callback
333
332
  */
334
- export declare function utimes(path: PathLike, atime: number | Date, mtime: number | Date, cb?: Callback): void;
333
+ export declare function utimes(path: fs.PathLike, atime: number | Date, mtime: number | Date, cb?: Callback): void;
335
334
  /**
336
335
  * Change file timestamps of the file referenced by the supplied path.
337
336
  * @param path
@@ -339,7 +338,7 @@ export declare function utimes(path: PathLike, atime: number | Date, mtime: numb
339
338
  * @param mtime
340
339
  * @param callback
341
340
  */
342
- export declare function lutimes(path: PathLike, atime: number | Date, mtime: number | Date, cb?: Callback): void;
341
+ export declare function lutimes(path: fs.PathLike, atime: number | Date, mtime: number | Date, cb?: Callback): void;
343
342
  /**
344
343
  * Asynchronous `realpath`. The callback gets two arguments
345
344
  * `(err, resolvedPath)`. May use `process.cwd` to resolve relative paths.
@@ -347,35 +346,35 @@ export declare function lutimes(path: PathLike, atime: number | Date, mtime: num
347
346
  * @param path
348
347
  * @param callback
349
348
  */
350
- export declare function realpath(path: PathLike, cb?: Callback<[string]>): void;
351
- export declare function realpath(path: PathLike, options: Node.EncodingOption, cb: Callback<[string]>): void;
349
+ export declare function realpath(path: fs.PathLike, cb?: Callback<[string]>): void;
350
+ export declare function realpath(path: fs.PathLike, options: fs.EncodingOption, cb: Callback<[string]>): void;
352
351
  /**
353
352
  * Asynchronous `access`.
354
353
  * @param path
355
354
  * @param mode
356
355
  * @param callback
357
356
  */
358
- export declare function access(path: PathLike, cb: Callback): void;
359
- export declare function access(path: PathLike, mode: number, cb: Callback): void;
357
+ export declare function access(path: fs.PathLike, cb: Callback): void;
358
+ export declare function access(path: fs.PathLike, mode: number, cb: Callback): void;
360
359
  /**
361
360
  * @todo Implement
362
361
  */
363
- export declare function watchFile(filename: PathLike, listener: (curr: Stats, prev: Stats) => void): void;
364
- export declare function watchFile(filename: PathLike, options: {
362
+ export declare function watchFile(path: fs.PathLike, listener: (curr: Stats, prev: Stats) => void): void;
363
+ export declare function watchFile(path: fs.PathLike, options: {
365
364
  persistent?: boolean;
366
365
  interval?: number;
367
366
  }, listener: (curr: Stats, prev: Stats) => void): void;
368
367
  /**
369
368
  * @todo Implement
370
369
  */
371
- export declare function unwatchFile(filename: PathLike, listener?: (curr: Stats, prev: Stats) => void): void;
370
+ export declare function unwatchFile(path: fs.PathLike, listener?: (curr: Stats, prev: Stats) => void): void;
372
371
  /**
373
372
  * @todo Implement
374
373
  */
375
- export declare function watch(filename: PathLike, listener?: (event: string, filename: string) => any): Node.FSWatcher;
376
- export declare function watch(filename: PathLike, options: {
374
+ export declare function watch(path: fs.PathLike, listener?: (event: string, filename: string) => any): fs.FSWatcher;
375
+ export declare function watch(path: fs.PathLike, options: {
377
376
  persistent?: boolean;
378
- }, listener?: (event: string, filename: string) => any): Node.FSWatcher;
377
+ }, listener?: (event: string, filename: string) => any): fs.FSWatcher;
379
378
  interface StreamOptions {
380
379
  flags?: string;
381
380
  encoding?: BufferEncoding;
@@ -388,19 +387,19 @@ interface StreamOptions {
388
387
  highWaterMark?: number;
389
388
  }
390
389
  interface FSImplementation {
391
- open?: (...args: any[]) => unknown;
392
- close?: (...args: any[]) => unknown;
390
+ open?: (...args: unknown[]) => unknown;
391
+ close?: (...args: unknown[]) => unknown;
393
392
  }
394
393
  interface ReadStreamOptions extends StreamOptions {
395
394
  fs?: FSImplementation & {
396
- read: (...args: any[]) => unknown;
395
+ read: (...args: unknown[]) => unknown;
397
396
  };
398
397
  end?: number;
399
398
  }
400
399
  interface WriteStreamOptions extends StreamOptions {
401
400
  fs?: FSImplementation & {
402
- write: (...args: any[]) => unknown;
403
- writev?: (...args: any[]) => unknown;
401
+ write: (...args: unknown[]) => unknown;
402
+ writev?: (...args: unknown[]) => unknown;
404
403
  };
405
404
  flush?: boolean;
406
405
  }
@@ -411,7 +410,7 @@ interface WriteStreamOptions extends StreamOptions {
411
410
  * @param options Options for the ReadStream and file opening (e.g., `encoding`, `highWaterMark`, `mode`).
412
411
  * @returns A ReadStream object for interacting with the file's contents.
413
412
  */
414
- export declare function createReadStream(path: PathLike, _options?: BufferEncoding | ReadStreamOptions): ReadStream;
413
+ export declare function createReadStream(path: fs.PathLike, _options?: BufferEncoding | ReadStreamOptions): ReadStream;
415
414
  /**
416
415
  * Opens a file in write mode and creates a Node.js-like WriteStream.
417
416
  *
@@ -419,34 +418,34 @@ export declare function createReadStream(path: PathLike, _options?: BufferEncodi
419
418
  * @param options Options for the WriteStream and file opening (e.g., `encoding`, `highWaterMark`, `mode`).
420
419
  * @returns A WriteStream object for writing to the file.
421
420
  */
422
- export declare function createWriteStream(path: PathLike, _options?: BufferEncoding | WriteStreamOptions): WriteStream;
423
- export declare function rm(path: PathLike, callback: Callback): void;
424
- export declare function rm(path: PathLike, options: Node.RmOptions, callback: Callback): void;
421
+ export declare function createWriteStream(path: fs.PathLike, _options?: BufferEncoding | WriteStreamOptions): WriteStream;
422
+ export declare function rm(path: fs.PathLike, callback: Callback): void;
423
+ export declare function rm(path: fs.PathLike, options: fs.RmOptions, callback: Callback): void;
425
424
  /**
426
425
  * Asynchronously creates a unique temporary directory.
427
426
  * Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
428
427
  */
429
428
  export declare function mkdtemp(prefix: string, callback: Callback<[string]>): void;
430
- export declare function mkdtemp(prefix: string, options: Node.EncodingOption, callback: Callback<[string]>): void;
431
- export declare function mkdtemp(prefix: string, options: Node.BufferEncodingOption, callback: Callback<[Buffer]>): void;
432
- export declare function copyFile(src: PathLike, dest: PathLike, callback: Callback): void;
433
- export declare function copyFile(src: PathLike, dest: PathLike, flags: number, callback: Callback): void;
429
+ export declare function mkdtemp(prefix: string, options: fs.EncodingOption, callback: Callback<[string]>): void;
430
+ export declare function mkdtemp(prefix: string, options: fs.BufferEncodingOption, callback: Callback<[Buffer]>): void;
431
+ export declare function copyFile(src: fs.PathLike, dest: fs.PathLike, callback: Callback): void;
432
+ export declare function copyFile(src: fs.PathLike, dest: fs.PathLike, flags: number, callback: Callback): void;
434
433
  type readvCb = Callback<[number, NodeJS.ArrayBufferView[]]>;
435
434
  export declare function readv(fd: number, buffers: NodeJS.ArrayBufferView[], cb: readvCb): void;
436
435
  export declare function readv(fd: number, buffers: NodeJS.ArrayBufferView[], position: number, cb: readvCb): void;
437
436
  type writevCb = Callback<[number, NodeJS.ArrayBufferView[]]>;
438
437
  export declare function writev(fd: number, buffers: Uint8Array[], cb: writevCb): void;
439
438
  export declare function writev(fd: number, buffers: Uint8Array[], position: number, cb: writevCb): void;
440
- export declare function opendir(path: PathLike, cb: Callback<[Dir]>): void;
441
- export declare function opendir(path: PathLike, options: Node.OpenDirOptions, cb: Callback<[Dir]>): void;
442
- export declare function cp(source: PathLike, destination: PathLike, callback: Callback): void;
443
- export declare function cp(source: PathLike, destination: PathLike, opts: Node.CopyOptions, callback: Callback): void;
444
- export declare function statfs(path: PathLike, callback: Callback<[StatsFs]>): void;
445
- export declare function statfs(path: PathLike, options: Node.StatFsOptions & {
439
+ export declare function opendir(path: fs.PathLike, cb: Callback<[Dir]>): void;
440
+ export declare function opendir(path: fs.PathLike, options: fs.OpenDirOptions, cb: Callback<[Dir]>): void;
441
+ export declare function cp(source: fs.PathLike, destination: fs.PathLike, callback: Callback): void;
442
+ export declare function cp(source: fs.PathLike, destination: fs.PathLike, opts: fs.CopyOptions, callback: Callback): void;
443
+ export declare function statfs(path: fs.PathLike, callback: Callback<[StatsFs]>): void;
444
+ export declare function statfs(path: fs.PathLike, options: fs.StatFsOptions & {
446
445
  bigint?: false;
447
446
  }, callback: Callback<[StatsFs]>): void;
448
- export declare function statfs(path: PathLike, options: Node.StatFsOptions & {
447
+ export declare function statfs(path: fs.PathLike, options: fs.StatFsOptions & {
449
448
  bigint: true;
450
449
  }, callback: Callback<[BigIntStatsFs]>): void;
451
- export declare function openAsBlob(path: PathLike, options?: Node.OpenAsBlobOptions): Promise<Blob>;
450
+ export declare function openAsBlob(path: fs.PathLike, options?: fs.OpenAsBlobOptions): Promise<Blob>;
452
451
  export {};