@zenfs/core 2.0.0 → 2.1.0

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 (87) hide show
  1. package/dist/backends/backend.js +6 -5
  2. package/dist/backends/cow.d.ts +2 -2
  3. package/dist/backends/cow.js +39 -58
  4. package/dist/backends/fetch.js +27 -29
  5. package/dist/backends/passthrough.d.ts +2 -3
  6. package/dist/backends/passthrough.js +84 -199
  7. package/dist/backends/port.d.ts +16 -3
  8. package/dist/backends/port.js +61 -30
  9. package/dist/backends/single_buffer.d.ts +52 -46
  10. package/dist/backends/single_buffer.js +462 -219
  11. package/dist/backends/store/fs.d.ts +16 -10
  12. package/dist/backends/store/fs.js +227 -242
  13. package/dist/backends/store/store.d.ts +3 -3
  14. package/dist/backends/store/store.js +11 -10
  15. package/dist/config.d.ts +2 -2
  16. package/dist/config.js +10 -11
  17. package/dist/internal/devices.d.ts +2 -2
  18. package/dist/internal/devices.js +39 -49
  19. package/dist/internal/error.d.ts +9 -204
  20. package/dist/internal/error.js +19 -288
  21. package/dist/internal/file_index.d.ts +1 -1
  22. package/dist/internal/file_index.js +9 -9
  23. package/dist/internal/filesystem.d.ts +23 -8
  24. package/dist/internal/index.d.ts +1 -1
  25. package/dist/internal/index.js +1 -1
  26. package/dist/internal/index_fs.d.ts +2 -2
  27. package/dist/internal/index_fs.js +19 -19
  28. package/dist/internal/inode.d.ts +81 -103
  29. package/dist/internal/inode.js +336 -195
  30. package/dist/mixins/async.js +32 -28
  31. package/dist/mixins/mutexed.d.ts +4 -4
  32. package/dist/mixins/mutexed.js +39 -39
  33. package/dist/mixins/readonly.d.ts +2 -2
  34. package/dist/mixins/readonly.js +20 -20
  35. package/dist/mixins/sync.js +2 -2
  36. package/dist/polyfills.js +1 -1
  37. package/dist/readline.js +1 -1
  38. package/dist/utils.d.ts +8 -5
  39. package/dist/utils.js +14 -17
  40. package/dist/vfs/acl.d.ts +8 -8
  41. package/dist/vfs/acl.js +66 -47
  42. package/dist/vfs/async.d.ts +2 -2
  43. package/dist/vfs/async.js +6 -8
  44. package/dist/vfs/dir.d.ts +1 -1
  45. package/dist/vfs/dir.js +3 -4
  46. package/dist/vfs/file.js +33 -24
  47. package/dist/vfs/flags.js +3 -3
  48. package/dist/vfs/ioctl.d.ts +8 -7
  49. package/dist/vfs/ioctl.js +132 -27
  50. package/dist/vfs/promises.d.ts +3 -3
  51. package/dist/vfs/promises.js +200 -235
  52. package/dist/vfs/shared.d.ts +1 -12
  53. package/dist/vfs/shared.js +7 -35
  54. package/dist/vfs/streams.js +9 -9
  55. package/dist/vfs/sync.d.ts +1 -2
  56. package/dist/vfs/sync.js +158 -170
  57. package/dist/vfs/watchers.js +8 -8
  58. package/dist/vfs/xattr.js +89 -106
  59. package/package.json +4 -2
  60. package/scripts/test.js +2 -2
  61. package/tests/assignment.ts +1 -1
  62. package/tests/backend/port.test.ts +4 -4
  63. package/tests/backend/single-buffer.test.ts +39 -10
  64. package/tests/backend/single-buffer.worker.js +30 -0
  65. package/tests/common/context.test.ts +2 -2
  66. package/tests/common/mutex.test.ts +9 -9
  67. package/tests/fetch/fetch.ts +1 -1
  68. package/tests/fs/append.test.ts +4 -4
  69. package/tests/fs/directory.test.ts +25 -25
  70. package/tests/fs/errors.test.ts +15 -19
  71. package/tests/fs/links.test.ts +3 -2
  72. package/tests/fs/open.test.ts +4 -21
  73. package/tests/fs/permissions.test.ts +8 -13
  74. package/tests/fs/read.test.ts +10 -9
  75. package/tests/fs/readFile.test.ts +8 -24
  76. package/tests/fs/rename.test.ts +4 -9
  77. package/tests/fs/stat.test.ts +2 -2
  78. package/tests/fs/times.test.ts +6 -6
  79. package/tests/fs/truncate.test.ts +8 -36
  80. package/tests/fs/watch.test.ts +10 -10
  81. package/tests/fs/write.test.ts +77 -13
  82. package/tests/fs/xattr.test.ts +7 -7
  83. package/tests/logs.js +2 -2
  84. package/tests/setup/port.ts +6 -0
  85. package/dist/internal/log.d.ts +0 -139
  86. package/dist/internal/log.js +0 -219
  87. package/tests/fs/writeFile.test.ts +0 -70
@@ -79,11 +79,11 @@ export declare class StoreFS<T extends Store = Store> extends FileSystem {
79
79
  /**
80
80
  * Updated the inode and data node at `path`
81
81
  */
82
- sync(path: string, data?: Uint8Array, metadata?: Readonly<InodeLike>): Promise<void>;
82
+ sync(): Promise<void>;
83
83
  /**
84
84
  * Updated the inode and data node at `path`
85
85
  */
86
- syncSync(path: string, data?: Uint8Array, metadata?: Readonly<InodeLike>): void;
86
+ syncSync(): void;
87
87
  link(target: string, link: string): Promise<void>;
88
88
  linkSync(target: string, link: string): void;
89
89
  read(path: string, buffer: Uint8Array, offset: number, end: number): Promise<void>;
@@ -107,24 +107,30 @@ export declare class StoreFS<T extends Store = Store> extends FileSystem {
107
107
  * Populates the `_ids` and `_paths` maps with all existing files stored in the underlying `Store`.
108
108
  */
109
109
  private _populate;
110
+ /**
111
+ * Find an inode without using the ID tables
112
+ */
113
+ private _findInode;
114
+ /**
115
+ * Find an inode without using the ID tables
116
+ */
117
+ private _findInodeSync;
110
118
  /**
111
119
  * Finds the Inode of `path`.
112
120
  * @param path The path to look up.
113
121
  * @todo memoize/cache
114
122
  */
115
- protected findInode(tx: WrappedTransaction, path: string, syscall: string): Promise<Inode>;
123
+ protected findInode(tx: WrappedTransaction, path: string): Promise<Inode>;
116
124
  /**
117
125
  * Finds the Inode of `path`.
118
126
  * @param path The path to look up.
119
127
  * @return The Inode of the path p.
120
128
  * @todo memoize/cache
121
129
  */
122
- protected findInodeSync(tx: WrappedTransaction, path: string, syscall: string): Inode;
130
+ protected findInodeSync(tx: WrappedTransaction, path: string): Inode;
123
131
  private _lastID?;
124
- /**
125
- * Allocates a new ID and adds the ID/path
126
- */
127
- protected allocNew(path: string, syscall: string): number;
132
+ /** Allocates a new ID and adds the ID/path */
133
+ protected allocNew(path: string): number;
128
134
  /**
129
135
  * Commits a new file (well, a FILE or a DIRECTORY) to the file system with `mode`.
130
136
  * Note: This will commit the transaction.
@@ -132,7 +138,7 @@ export declare class StoreFS<T extends Store = Store> extends FileSystem {
132
138
  * @param options The options to create the new file with.
133
139
  * @param data The data to store at the file's data node.
134
140
  */
135
- protected commitNew(path: string, options: CreationOptions, data: Uint8Array, syscall: string): Promise<Inode>;
141
+ protected commitNew(path: string, options: CreationOptions, data: Uint8Array): Promise<Inode>;
136
142
  /**
137
143
  * Commits a new file (well, a FILE or a DIRECTORY) to the file system with `mode`.
138
144
  * Note: This will commit the transaction.
@@ -141,7 +147,7 @@ export declare class StoreFS<T extends Store = Store> extends FileSystem {
141
147
  * @param data The data to store at the file's data node.
142
148
  * @return The Inode for the new file.
143
149
  */
144
- protected commitNewSync(path: string, options: CreationOptions, data: Uint8Array, syscall: string): Inode;
150
+ protected commitNewSync(path: string, options: CreationOptions, data: Uint8Array): Inode;
145
151
  /**
146
152
  * Remove all traces of `path` from the file system.
147
153
  * @param path The path to remove from the file system.