@zenfs/core 1.9.2 → 1.9.3

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 (50) hide show
  1. package/dist/backends/backend.d.ts +16 -2
  2. package/dist/backends/backend.js +9 -2
  3. package/dist/backends/fetch.d.ts +6 -0
  4. package/dist/backends/fetch.js +10 -3
  5. package/dist/backends/memory.d.ts +1 -0
  6. package/dist/backends/memory.js +1 -0
  7. package/dist/backends/overlay.d.ts +1 -0
  8. package/dist/backends/passthrough.d.ts +4 -0
  9. package/dist/backends/store/fs.d.ts +1 -0
  10. package/dist/backends/store/fs.js +1 -0
  11. package/dist/backends/store/map.d.ts +6 -0
  12. package/dist/backends/store/map.js +4 -0
  13. package/dist/backends/store/simple.d.ts +3 -0
  14. package/dist/backends/store/simple.js +1 -0
  15. package/dist/backends/store/store.d.ts +12 -1
  16. package/dist/backends/store/store.js +5 -1
  17. package/dist/config.d.ts +9 -0
  18. package/dist/config.js +6 -0
  19. package/dist/context.d.ts +3 -4
  20. package/dist/context.js +1 -1
  21. package/dist/internal/credentials.d.ts +9 -0
  22. package/dist/internal/credentials.js +7 -0
  23. package/dist/internal/devices.d.ts +14 -0
  24. package/dist/internal/devices.js +10 -0
  25. package/dist/internal/error.d.ts +6 -0
  26. package/dist/internal/error.js +3 -0
  27. package/dist/internal/file.d.ts +23 -0
  28. package/dist/internal/file.js +23 -1
  29. package/dist/internal/file_index.d.ts +1 -0
  30. package/dist/internal/file_index.js +1 -0
  31. package/dist/internal/filesystem.d.ts +9 -0
  32. package/dist/internal/filesystem.js +1 -0
  33. package/dist/internal/index_fs.d.ts +2 -0
  34. package/dist/internal/index_fs.js +6 -2
  35. package/dist/internal/inode.d.ts +8 -0
  36. package/dist/internal/inode.js +1 -0
  37. package/dist/mixins/async.d.ts +6 -2
  38. package/dist/mixins/async.js +1 -1
  39. package/dist/mixins/mutexed.d.ts +6 -0
  40. package/dist/mixins/mutexed.js +6 -0
  41. package/dist/mixins/readonly.d.ts +1 -0
  42. package/dist/mixins/readonly.js +1 -0
  43. package/dist/mixins/shared.d.ts +3 -0
  44. package/dist/mixins/sync.d.ts +1 -0
  45. package/dist/mixins/sync.js +1 -0
  46. package/dist/vfs/shared.d.ts +4 -1
  47. package/dist/vfs/shared.js +3 -1
  48. package/package.json +1 -1
  49. package/readme.md +4 -0
  50. package/tests/backend/fetch.test.ts +3 -2
@@ -69,6 +69,8 @@ import { alert, debug, err, info, log_deprecated } from './log.js';
69
69
  * This class only does some simple things:
70
70
  * It implements `truncate` using `write` and it has non-device methods throw.
71
71
  * It is up to device drivers to implement the rest of the functionality.
72
+ * @category Internals
73
+ * @internal
72
74
  */
73
75
  export class DeviceFile extends File {
74
76
  constructor(fs, path, device) {
@@ -162,6 +164,7 @@ export class DeviceFile extends File {
162
164
  }
163
165
  /**
164
166
  * A temporary file system that manages and interfaces with devices
167
+ * @category Internals
165
168
  */
166
169
  export class DeviceFS extends StoreFS {
167
170
  /* node:coverage disable */
@@ -439,6 +442,7 @@ const emptyBuffer = new Uint8Array();
439
442
  * Simulates the `/dev/null` device.
440
443
  * - Reads return 0 bytes (EOF).
441
444
  * - Writes discard data, advancing the file position.
445
+ * @category Internals
442
446
  * @internal
443
447
  */
444
448
  export const nullDevice = {
@@ -463,6 +467,7 @@ export const nullDevice = {
463
467
  * - Reads fill the buffer with zeroes.
464
468
  * - Writes discard data but update the file position.
465
469
  * - Provides basic file metadata, treating it as a character device.
470
+ * @category Internals
466
471
  * @internal
467
472
  */
468
473
  export const zeroDevice = {
@@ -480,6 +485,7 @@ export const zeroDevice = {
480
485
  * Simulates the `/dev/full` device.
481
486
  * - Reads behave like `/dev/zero` (returns zeroes).
482
487
  * - Writes always fail with ENOSPC (no space left on device).
488
+ * @category Internals
483
489
  * @internal
484
490
  */
485
491
  export const fullDevice = {
@@ -502,6 +508,7 @@ export const fullDevice = {
502
508
  * Simulates the `/dev/random` device.
503
509
  * - Reads return random bytes.
504
510
  * - Writes discard data, advancing the file position.
511
+ * @category Internals
505
512
  * @internal
506
513
  */
507
514
  export const randomDevice = {
@@ -519,6 +526,7 @@ export const randomDevice = {
519
526
  };
520
527
  /**
521
528
  * Simulates the `/dev/console` device.
529
+ * @category Internals
522
530
  * @experimental @internal
523
531
  */
524
532
  const consoleDevice = {
@@ -537,6 +545,8 @@ const consoleDevice = {
537
545
  };
538
546
  /**
539
547
  * Shortcuts for importing.
548
+ * @category Internals
549
+ * @internal
540
550
  */
541
551
  export const devices = {
542
552
  null: nullDevice,
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * Standard libc error codes. More will be added to this enum and error strings as they are
3
3
  * needed.
4
+ * @category Internals
4
5
  * @see https://en.wikipedia.org/wiki/Errno.h
5
6
  */
6
7
  export declare enum Errno {
@@ -155,11 +156,15 @@ export declare enum Errno {
155
156
  }
156
157
  /**
157
158
  * Strings associated with each error code.
159
+ * @category Internals
158
160
  * @internal
159
161
  */
160
162
  export declare const errorMessages: {
161
163
  [K in Errno]: string;
162
164
  };
165
+ /**
166
+ * @category Internals
167
+ */
163
168
  export interface ErrnoErrorJSON {
164
169
  errno: Errno;
165
170
  message: string;
@@ -170,6 +175,7 @@ export interface ErrnoErrorJSON {
170
175
  }
171
176
  /**
172
177
  * An error with additional information about what happened
178
+ * @category Internals
173
179
  */
174
180
  export declare class ErrnoError extends Error implements NodeJS.ErrnoException {
175
181
  /**
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * Standard libc error codes. More will be added to this enum and error strings as they are
3
3
  * needed.
4
+ * @category Internals
4
5
  * @see https://en.wikipedia.org/wiki/Errno.h
5
6
  */
6
7
  export var Errno;
@@ -156,6 +157,7 @@ export var Errno;
156
157
  })(Errno || (Errno = {}));
157
158
  /**
158
159
  * Strings associated with each error code.
160
+ * @category Internals
159
161
  * @internal
160
162
  */
161
163
  export const errorMessages = {
@@ -236,6 +238,7 @@ export const errorMessages = {
236
238
  };
237
239
  /**
238
240
  * An error with additional information about what happened
241
+ * @category Internals
239
242
  */
240
243
  export class ErrnoError extends Error {
241
244
  static fromJSON(json) {
@@ -1,24 +1,44 @@
1
1
  import { Stats, type StatsLike } from '../stats.js';
2
2
  import type { FileSystem } from './filesystem.js';
3
3
  import '../polyfills.js';
4
+ /**
5
+ * @internal @hidden
6
+ */
4
7
  export declare function parseFlag(flag: string | number): string;
8
+ /**
9
+ * @internal @hidden
10
+ */
5
11
  export declare function flagToString(flag: number): string;
12
+ /**
13
+ * @internal @hidden
14
+ */
6
15
  export declare function flagToNumber(flag: string): number;
7
16
  /**
8
17
  * Parses a flag as a mode (W_OK, R_OK, and/or X_OK)
9
18
  * @param flag the flag to parse
19
+ * @internal @hidden
10
20
  */
11
21
  export declare function flagToMode(flag: string): number;
22
+ /** @hidden */
12
23
  export declare function isReadable(flag: string): boolean;
24
+ /** @hidden */
13
25
  export declare function isWriteable(flag: string): boolean;
26
+ /** @hidden */
14
27
  export declare function isTruncating(flag: string): boolean;
28
+ /** @hidden */
15
29
  export declare function isAppendable(flag: string): boolean;
30
+ /** @hidden */
16
31
  export declare function isSynchronous(flag: string): boolean;
32
+ /** @hidden */
17
33
  export declare function isExclusive(flag: string): boolean;
34
+ /** @hidden */
18
35
  export interface FileReadResult<T extends ArrayBufferView> {
19
36
  bytesRead: number;
20
37
  buffer: T;
21
38
  }
39
+ /**
40
+ * @category Internals
41
+ */
22
42
  export declare abstract class File<FS extends FileSystem = FileSystem> {
23
43
  /**
24
44
  * @internal
@@ -108,6 +128,7 @@ export declare abstract class File<FS extends FileSystem = FileSystem> {
108
128
  /**
109
129
  * An implementation of `File` that operates completely in-memory.
110
130
  * `PreloadFile`s are backed by a `Uint8Array`.
131
+ * @category Internals
111
132
  */
112
133
  export declare class PreloadFile<FS extends FileSystem> extends File<FS> {
113
134
  readonly flag: string;
@@ -217,6 +238,7 @@ export declare class PreloadFile<FS extends FileSystem> extends File<FS> {
217
238
  }
218
239
  /**
219
240
  * For the file systems which do not sync to anything.
241
+ * @category Internals
220
242
  * @deprecated
221
243
  */
222
244
  export declare class NoSyncFile<T extends FileSystem> extends PreloadFile<T> {
@@ -228,6 +250,7 @@ export declare class NoSyncFile<T extends FileSystem> extends PreloadFile<T> {
228
250
  }
229
251
  /**
230
252
  * An implementation of `File` that uses the FS
253
+ * @category Internals
231
254
  */
232
255
  export declare class LazyFile<FS extends FileSystem> extends File<FS> {
233
256
  readonly flag: string;
@@ -5,8 +5,11 @@ import * as c from '../vfs/constants.js';
5
5
  import { Errno, ErrnoError } from './error.js';
6
6
  import { log_deprecated } from './log.js';
7
7
  import '../polyfills.js';
8
- const maxByteLength = 0x100000; // 1 MiB
8
+ const maxByteLength = 0xffff; // 64 KiB
9
9
  const validFlags = ['r', 'r+', 'rs', 'rs+', 'w', 'wx', 'w+', 'wx+', 'a', 'ax', 'a+', 'ax+'];
10
+ /**
11
+ * @internal @hidden
12
+ */
10
13
  export function parseFlag(flag) {
11
14
  if (typeof flag === 'number') {
12
15
  return flagToString(flag);
@@ -16,6 +19,9 @@ export function parseFlag(flag) {
16
19
  }
17
20
  return flag;
18
21
  }
22
+ /**
23
+ * @internal @hidden
24
+ */
19
25
  export function flagToString(flag) {
20
26
  switch (flag) {
21
27
  case c.O_RDONLY:
@@ -46,6 +52,9 @@ export function flagToString(flag) {
46
52
  throw new Error('Invalid flag number: ' + flag);
47
53
  }
48
54
  }
55
+ /**
56
+ * @internal @hidden
57
+ */
49
58
  export function flagToNumber(flag) {
50
59
  switch (flag) {
51
60
  case 'r':
@@ -79,6 +88,7 @@ export function flagToNumber(flag) {
79
88
  /**
80
89
  * Parses a flag as a mode (W_OK, R_OK, and/or X_OK)
81
90
  * @param flag the flag to parse
91
+ * @internal @hidden
82
92
  */
83
93
  export function flagToMode(flag) {
84
94
  let mode = 0;
@@ -89,24 +99,33 @@ export function flagToMode(flag) {
89
99
  mode <<= 1;
90
100
  return mode;
91
101
  }
102
+ /** @hidden */
92
103
  export function isReadable(flag) {
93
104
  return flag.indexOf('r') !== -1 || flag.indexOf('+') !== -1;
94
105
  }
106
+ /** @hidden */
95
107
  export function isWriteable(flag) {
96
108
  return flag.indexOf('w') !== -1 || flag.indexOf('a') !== -1 || flag.indexOf('+') !== -1;
97
109
  }
110
+ /** @hidden */
98
111
  export function isTruncating(flag) {
99
112
  return flag.indexOf('w') !== -1;
100
113
  }
114
+ /** @hidden */
101
115
  export function isAppendable(flag) {
102
116
  return flag.indexOf('a') !== -1;
103
117
  }
118
+ /** @hidden */
104
119
  export function isSynchronous(flag) {
105
120
  return flag.indexOf('s') !== -1;
106
121
  }
122
+ /** @hidden */
107
123
  export function isExclusive(flag) {
108
124
  return flag.indexOf('x') !== -1;
109
125
  }
126
+ /**
127
+ * @category Internals
128
+ */
110
129
  export class File {
111
130
  constructor(
112
131
  /**
@@ -139,6 +158,7 @@ export class File {
139
158
  /**
140
159
  * An implementation of `File` that operates completely in-memory.
141
160
  * `PreloadFile`s are backed by a `Uint8Array`.
161
+ * @category Internals
142
162
  */
143
163
  export class PreloadFile extends File {
144
164
  /**
@@ -437,6 +457,7 @@ export class PreloadFile extends File {
437
457
  /* node:coverage disable */
438
458
  /**
439
459
  * For the file systems which do not sync to anything.
460
+ * @category Internals
440
461
  * @deprecated
441
462
  */
442
463
  export class NoSyncFile extends PreloadFile {
@@ -456,6 +477,7 @@ export class NoSyncFile extends PreloadFile {
456
477
  /* node:coverage enable */
457
478
  /**
458
479
  * An implementation of `File` that uses the FS
480
+ * @category Internals
459
481
  */
460
482
  export class LazyFile extends File {
461
483
  /**
@@ -11,6 +11,7 @@ export interface IndexData {
11
11
  export declare const version = 1;
12
12
  /**
13
13
  * An index of files
14
+ * @category Internals
14
15
  * @internal
15
16
  */
16
17
  export declare class Index extends Map<string, Inode> {
@@ -7,6 +7,7 @@ import { Inode } from './inode.js';
7
7
  export const version = 1;
8
8
  /**
9
9
  * An index of files
10
+ * @category Internals
10
11
  * @internal
11
12
  */
12
13
  export class Index extends Map {
@@ -3,6 +3,8 @@ import type { Stats, StatsLike } from '../stats.js';
3
3
  import type { File } from './file.js';
4
4
  /**
5
5
  * Usage information about a file system
6
+ * @category Internals
7
+ * @internal
6
8
  */
7
9
  export interface UsageInfo {
8
10
  /**
@@ -29,6 +31,7 @@ export interface UsageInfo {
29
31
  }
30
32
  /**
31
33
  * Metadata about a FileSystem
34
+ * @category Internals
32
35
  * @deprecated
33
36
  */
34
37
  export interface FileSystemMetadata extends UsageInfo {
@@ -69,6 +72,8 @@ export interface FileSystemMetadata extends UsageInfo {
69
72
  /**
70
73
  * Attributes that control how the file system interacts with the VFS.
71
74
  * No options are set by default.
75
+ * @category Internals
76
+ * @internal
72
77
  */
73
78
  export type FileSystemAttributes = {
74
79
  /** The FS supports setuid and setgid when creating files and directories. */
@@ -96,6 +101,7 @@ export type FileSystemAttributes = {
96
101
  * Options used when creating files and directories.
97
102
  * This weird naming and such is to preserve backward compatibility.
98
103
  * @todo [BREAKING] Move the `mode` parameter of `createFile` and `mkdir` into this
104
+ * @category Internals
99
105
  * @internal
100
106
  */
101
107
  export interface CreationOptions {
@@ -116,6 +122,8 @@ export interface CreationOptions {
116
122
  }
117
123
  /**
118
124
  * This is the correct type that will be used when the API is updated in a breaking release
125
+ * @category Internals
126
+ * @internal
119
127
  */
120
128
  export interface PureCreationOptions extends CreationOptions {
121
129
  /**
@@ -127,6 +135,7 @@ export interface PureCreationOptions extends CreationOptions {
127
135
  * Provides a consistent and easy to use internal API.
128
136
  * Default implementations for `exists` and `existsSync` are included.
129
137
  * If you are extending this class, note that every path is an absolute path and all arguments are present.
138
+ * @category Internals
130
139
  * @internal
131
140
  */
132
141
  export declare abstract class FileSystem {
@@ -2,6 +2,7 @@
2
2
  * Provides a consistent and easy to use internal API.
3
3
  * Default implementations for `exists` and `existsSync` are included.
4
4
  * If you are extending this class, note that every path is an absolute path and all arguments are present.
5
+ * @category Internals
5
6
  * @internal
6
7
  */
7
8
  export class FileSystem {
@@ -5,6 +5,8 @@ import { FileSystem, type CreationOptions, type PureCreationOptions } from './fi
5
5
  import { Inode, type InodeLike } from './inode.js';
6
6
  /**
7
7
  * Uses an `Index` for metadata.
8
+ * @category Internals
9
+ * @internal
8
10
  */
9
11
  export declare abstract class IndexFS extends FileSystem {
10
12
  readonly index: Index;
@@ -10,6 +10,8 @@ import { FileSystem } from './filesystem.js';
10
10
  import { Inode } from './inode.js';
11
11
  /**
12
12
  * Uses an `Index` for metadata.
13
+ * @category Internals
14
+ * @internal
13
15
  */
14
16
  export class IndexFS extends FileSystem {
15
17
  constructor(id, name, index = new Index()) {
@@ -34,8 +36,6 @@ export class IndexFS extends FileSystem {
34
36
  * Finds all the paths in the index that need to be moved for a rename
35
37
  */
36
38
  pathsForRename(oldPath, newPath) {
37
- if (newPath === oldPath)
38
- return [];
39
39
  if (!this.index.has(oldPath))
40
40
  throw ErrnoError.With('ENOENT', oldPath, 'rename');
41
41
  if ((dirname(newPath) + '/').startsWith(oldPath + '/'))
@@ -53,6 +53,8 @@ export class IndexFS extends FileSystem {
53
53
  return toRename;
54
54
  }
55
55
  async rename(oldPath, newPath) {
56
+ if (oldPath == newPath)
57
+ return;
56
58
  for (const { from, to, inode } of this.pathsForRename(oldPath, newPath)) {
57
59
  const data = new Uint8Array(inode.size);
58
60
  await this.read(from, data, 0, inode.size);
@@ -63,6 +65,8 @@ export class IndexFS extends FileSystem {
63
65
  await this.remove(oldPath);
64
66
  }
65
67
  renameSync(oldPath, newPath) {
68
+ if (oldPath == newPath)
69
+ return;
66
70
  for (const { from, to, inode } of this.pathsForRename(oldPath, newPath)) {
67
71
  const data = new Uint8Array(inode.size);
68
72
  this.readSync(from, data, 0, inode.size);
@@ -4,10 +4,17 @@ import { Stats, type StatsLike } from '../stats.js';
4
4
  * @hidden
5
5
  */
6
6
  export declare const rootIno = 0;
7
+ /**
8
+ * @internal @hidden
9
+ */
7
10
  export interface InodeFields {
8
11
  data?: number;
9
12
  flags?: number;
10
13
  }
14
+ /**
15
+ * @category Internals
16
+ * @internal
17
+ */
11
18
  export interface InodeLike extends StatsLike<number>, InodeFields {
12
19
  }
13
20
  /**
@@ -16,6 +23,7 @@ export interface InodeLike extends StatsLike<number>, InodeFields {
16
23
  export declare const _inode_fields: readonly ["ino", "data", "size", "mode", "flags", "nlink", "uid", "gid", "atimeMs", "birthtimeMs", "mtimeMs", "ctimeMs"];
17
24
  /**
18
25
  * Generic inode definition that can easily be serialized.
26
+ * @category Internals
19
27
  * @internal
20
28
  * @todo [BREAKING] Remove 58 byte Inode upgrade path
21
29
  */
@@ -51,6 +51,7 @@ export const rootIno = 0;
51
51
  export const _inode_fields = ['ino', 'data', 'size', 'mode', 'flags', 'nlink', 'uid', 'gid', 'atimeMs', 'birthtimeMs', 'mtimeMs', 'ctimeMs'];
52
52
  /**
53
53
  * Generic inode definition that can easily be serialized.
54
+ * @category Internals
54
55
  * @internal
55
56
  * @todo [BREAKING] Remove 58 byte Inode upgrade path
56
57
  */
@@ -1,11 +1,15 @@
1
1
  import type { FileSystem } from '../internal/filesystem.js';
2
2
  import type { _SyncFSKeys, AsyncFSMethods, Mixin } from './shared.js';
3
- /** @internal */
3
+ /**
4
+ * @internal
5
+ * @category Internals
6
+ */
4
7
  export type AsyncOperation = {
5
8
  [K in keyof AsyncFSMethods]: [K, ...Parameters<FileSystem[K]>];
6
9
  }[keyof AsyncFSMethods];
7
10
  /**
8
11
  * @internal
12
+ * @category Internals
9
13
  */
10
14
  export interface AsyncMixin extends Pick<FileSystem, Exclude<_SyncFSKeys, 'existsSync'>> {
11
15
  /**
@@ -23,6 +27,6 @@ export interface AsyncMixin extends Pick<FileSystem, Exclude<_SyncFSKeys, 'exist
23
27
  * Synchronous methods on an asynchronous FS are implemented by performing operations over the in-memory copy,
24
28
  * while asynchronously pipelining them to the backing store.
25
29
  * During loading, the contents of the async file system are preloaded into the synchronous store.
26
- *
30
+ * @category Internals
27
31
  */
28
32
  export declare function Async<const T extends abstract new (...args: any[]) => FileSystem>(FS: T): Mixin<T, AsyncMixin>;
@@ -63,7 +63,7 @@ import { join } from '../vfs/path.js';
63
63
  * Synchronous methods on an asynchronous FS are implemented by performing operations over the in-memory copy,
64
64
  * while asynchronously pipelining them to the backing store.
65
65
  * During loading, the contents of the async file system are preloaded into the synchronous store.
66
- *
66
+ * @category Internals
67
67
  */
68
68
  export function Async(FS) {
69
69
  class AsyncFS extends FS {
@@ -4,6 +4,10 @@ import type { InodeLike } from '../internal/inode.js';
4
4
  import type { Stats } from '../stats.js';
5
5
  import type { Concrete } from '../utils.js';
6
6
  import '../polyfills.js';
7
+ /**
8
+ * @category Internals
9
+ * @internal
10
+ */
7
11
  export declare class MutexLock {
8
12
  protected readonly previous?: MutexLock | undefined;
9
13
  protected current: PromiseWithResolvers<void>;
@@ -16,6 +20,7 @@ export declare class MutexLock {
16
20
  }
17
21
  /**
18
22
  * @hidden
23
+ * @category Internals
19
24
  */
20
25
  export declare class _MutexedFS<T extends FileSystem> implements FileSystem {
21
26
  /**
@@ -99,6 +104,7 @@ export declare class _MutexedFS<T extends FileSystem> implements FileSystem {
99
104
  * `MutexedFS` implements it in order to make sure all of the methods are passed through
100
105
  *
101
106
  * @todo Change `using _` to `using void` pending https://github.com/tc39/proposal-discard-binding
107
+ * @category Internals
102
108
  * @internal
103
109
  */
104
110
  export declare function Mutexed<const T extends Concrete<typeof FileSystem>>(FS: T): typeof _MutexedFS<InstanceType<T>> & {
@@ -53,6 +53,10 @@ var __disposeResources = (this && this.__disposeResources) || (function (Suppres
53
53
  import { ErrnoError } from '../internal/error.js';
54
54
  import { err } from '../internal/log.js';
55
55
  import '../polyfills.js';
56
+ /**
57
+ * @category Internals
58
+ * @internal
59
+ */
56
60
  export class MutexLock {
57
61
  get isLocked() {
58
62
  return this._isLocked;
@@ -77,6 +81,7 @@ export class MutexLock {
77
81
  }
78
82
  /**
79
83
  * @hidden
84
+ * @category Internals
80
85
  */
81
86
  export class _MutexedFS {
82
87
  get id() {
@@ -541,6 +546,7 @@ export class _MutexedFS {
541
546
  * `MutexedFS` implements it in order to make sure all of the methods are passed through
542
547
  *
543
548
  * @todo Change `using _` to `using void` pending https://github.com/tc39/proposal-discard-binding
549
+ * @category Internals
544
550
  * @internal
545
551
  */
546
552
  export function Mutexed(FS) {
@@ -25,5 +25,6 @@ export interface ReadonlyMixin {
25
25
  }
26
26
  /**
27
27
  * Implements the non-readonly methods to throw `EROFS`
28
+ * @category Internals
28
29
  */
29
30
  export declare function Readonly<T extends abstract new (...args: any[]) => FileSystem>(FS: T): Mixin<T, ReadonlyMixin>;
@@ -1,6 +1,7 @@
1
1
  import { Errno, ErrnoError } from '../internal/error.js';
2
2
  /**
3
3
  * Implements the non-readonly methods to throw `EROFS`
4
+ * @category Internals
4
5
  */
5
6
  /* eslint-disable @typescript-eslint/require-await */
6
7
  export function Readonly(FS) {
@@ -2,6 +2,7 @@ import type { ExtractProperties } from 'utilium';
2
2
  import type { FileSystem } from '../internal/filesystem.js';
3
3
  /**
4
4
  * `TBase` with `TMixin` mixed-in.
5
+ * @category Internals
5
6
  * @internal
6
7
  */
7
8
  export type Mixin<TBase extends typeof FileSystem, TMixin> = (abstract new (...args: any[]) => TMixin) & TBase;
@@ -19,11 +20,13 @@ export type _AsyncFSKeys = {
19
20
  }[_SyncFSKeys];
20
21
  /**
21
22
  * Asynchronous `FileSystem` methods. This is a convenience type for all of the async operations.
23
+ * @category Internals
22
24
  * @internal
23
25
  */
24
26
  export type AsyncFSMethods = Pick<FileSystem, _AsyncFSKeys>;
25
27
  /**
26
28
  * Concrete `FileSystem`. This is a convenience type.
29
+ * @category Internals
27
30
  * @internal
28
31
  */
29
32
  export type ConcreteFS = ExtractProperties<FileSystem, any>;
@@ -2,5 +2,6 @@ import type { FileSystem } from '../internal/filesystem.js';
2
2
  import type { AsyncFSMethods, Mixin } from './shared.js';
3
3
  /**
4
4
  * Implements the asynchronous API in terms of the synchronous API.
5
+ * @category Internals
5
6
  */
6
7
  export declare function Sync<T extends abstract new (...args: any[]) => FileSystem>(FS: T): Mixin<T, AsyncFSMethods>;
@@ -1,5 +1,6 @@
1
1
  /**
2
2
  * Implements the asynchronous API in terms of the synchronous API.
3
+ * @category Internals
3
4
  */
4
5
  /* eslint-disable @typescript-eslint/require-await */
5
6
  export function Sync(FS) {
@@ -22,16 +22,19 @@ export declare function fd2file(fd: number): File;
22
22
  export type MountObject = Record<AbsolutePath, FileSystem>;
23
23
  /**
24
24
  * The map of mount points
25
+ * @category Backends and Configuration
25
26
  * @internal
26
27
  */
27
28
  export declare const mounts: Map<string, FileSystem>;
28
29
  /**
29
30
  * Mounts the file system at `mountPoint`.
31
+ * @category Backends and Configuration
30
32
  * @internal
31
33
  */
32
34
  export declare function mount(mountPoint: string, fs: FileSystem): void;
33
35
  /**
34
36
  * Unmounts the file system at `mountPoint`.
37
+ * @category Backends and Configuration
35
38
  */
36
39
  export declare function umount(mountPoint: string): void;
37
40
  /**
@@ -69,7 +72,7 @@ export declare function _statfs<const T extends boolean>(fs: FileSystem, bigint?
69
72
  /**
70
73
  * Change the root path
71
74
  * @param inPlace if true, this changes the root for the current context instead of creating a new one (if associated with a context).
72
- * @experimental
75
+ * @category Backends and Configuration
73
76
  */
74
77
  export declare function chroot(this: V_Context, path: string, inPlace?: false): BoundContext;
75
78
  export declare function chroot<T extends V_Context>(this: T, path: string, inPlace: true): T;
@@ -7,7 +7,6 @@ import { normalizePath } from '../utils.js';
7
7
  import { paths as pathCache } from './cache.js';
8
8
  import { size_max } from './constants.js';
9
9
  import { join, resolve } from './path.js';
10
- import { ZenFsType } from '../stats.js';
11
10
  // descriptors
12
11
  /**
13
12
  * @internal @hidden
@@ -33,6 +32,7 @@ export function fd2file(fd) {
33
32
  }
34
33
  /**
35
34
  * The map of mount points
35
+ * @category Backends and Configuration
36
36
  * @internal
37
37
  */
38
38
  export const mounts = new Map();
@@ -40,6 +40,7 @@ export const mounts = new Map();
40
40
  mount('/', InMemory.create({ name: 'root' }));
41
41
  /**
42
42
  * Mounts the file system at `mountPoint`.
43
+ * @category Backends and Configuration
43
44
  * @internal
44
45
  */
45
46
  export function mount(mountPoint, fs) {
@@ -57,6 +58,7 @@ export function mount(mountPoint, fs) {
57
58
  }
58
59
  /**
59
60
  * Unmounts the file system at `mountPoint`.
61
+ * @category Backends and Configuration
60
62
  */
61
63
  export function umount(mountPoint) {
62
64
  if (mountPoint[0] != '/')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zenfs/core",
3
- "version": "1.9.2",
3
+ "version": "1.9.3",
4
4
  "description": "A filesystem, anywhere",
5
5
  "funding": {
6
6
  "type": "individual",
package/readme.md CHANGED
@@ -1,3 +1,7 @@
1
+ ---
2
+ title: Overview
3
+ ---
4
+
1
5
  # ZenFS
2
6
 
3
7
  ZenFS is a cross-platform library that emulates the [NodeJS filesystem API](http://nodejs.org/api/fs.html). It works using a system of backends, which are used by ZenFS to store and retrieve data. ZenFS can also integrate with other tools.