@zenfs/core 2.2.0 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/backends/single_buffer.js +1 -1
- package/dist/index.js +2 -1
- package/package.json +3 -3
- package/readme.md +16 -9
|
@@ -710,7 +710,7 @@ export class SingleBufferStore extends BufferView {
|
|
|
710
710
|
return this._fs;
|
|
711
711
|
}
|
|
712
712
|
set fs(fs) {
|
|
713
|
-
if (this.buffer
|
|
713
|
+
if (this.buffer.constructor.name === 'SharedArrayBuffer')
|
|
714
714
|
fs === null || fs === void 0 ? void 0 : fs.attributes.set('no_id_tables', true);
|
|
715
715
|
this._fs = fs;
|
|
716
716
|
}
|
package/dist/index.js
CHANGED
|
@@ -10,4 +10,5 @@ export * from './vfs/index.js';
|
|
|
10
10
|
export { fs };
|
|
11
11
|
import * as fs from './vfs/index.js';
|
|
12
12
|
export default fs;
|
|
13
|
-
|
|
13
|
+
import $pkg from '../package.json' with { type: 'json' };
|
|
14
|
+
globalThis.__zenfs__ = Object.assign(Object.create(fs), { _version: $pkg.version });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zenfs/core",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.1",
|
|
4
4
|
"description": "A filesystem, anywhere",
|
|
5
5
|
"funding": {
|
|
6
6
|
"type": "individual",
|
|
@@ -81,10 +81,10 @@
|
|
|
81
81
|
"@types/eslint__js": "^8.42.3",
|
|
82
82
|
"c8": "^10.1.2",
|
|
83
83
|
"eslint": "^9.15.0",
|
|
84
|
-
"globals": "^
|
|
84
|
+
"globals": "^16.0.0",
|
|
85
85
|
"prettier": "^3.2.5",
|
|
86
86
|
"tsx": "^4.19.1",
|
|
87
|
-
"typedoc": "^0.
|
|
87
|
+
"typedoc": "^0.28.0",
|
|
88
88
|
"typescript": "^5.7.2",
|
|
89
89
|
"typescript-eslint": "^8.16.0"
|
|
90
90
|
}
|
package/readme.md
CHANGED
|
@@ -1,23 +1,28 @@
|
|
|
1
1
|
# ZenFS
|
|
2
2
|
|
|
3
|
-
ZenFS is a cross-platform library that emulates the [
|
|
3
|
+
ZenFS is a cross-platform library that emulates the [Node.js filesystem API](http://nodejs.org/api/fs.html).
|
|
4
|
+
It works using a system of backends, which are used by ZenFS to store and retrieve data.
|
|
5
|
+
ZenFS can also integrate with other tools.
|
|
4
6
|
|
|
5
7
|
## Backends
|
|
6
8
|
|
|
7
|
-
ZenFS is modular and
|
|
9
|
+
ZenFS is modular and easily extended. The core includes some built-in backends:
|
|
8
10
|
|
|
9
11
|
- `InMemory`: Stores files in-memory. This is cleared when the runtime ends (e.g. a user navigating away from a web page or a Node process exiting)
|
|
10
|
-
- `CopyOnWrite`: Use readable and writable file systems with
|
|
12
|
+
- `CopyOnWrite`: Use readable and writable file systems with [copy-on-write](https://en.wikipedia.org/wiki/Copy-on-write).
|
|
11
13
|
- `Fetch`: Downloads files over HTTP with the `fetch` API
|
|
12
14
|
- `Port`: Interacts with a remote over a `MessagePort`-like interface (e.g. a worker)
|
|
13
15
|
- `Passthrough`: Use an existing `node:fs` interface with ZenFS
|
|
14
16
|
- `SingleBuffer`: A backend contained within a single buffer. Can be used for synchronous multi-threaded operations using `SharedArrayBuffer`
|
|
15
17
|
|
|
16
|
-
ZenFS supports a number of other backends.
|
|
18
|
+
ZenFS supports a number of other backends.
|
|
19
|
+
Many are provided as separate packages under `@zenfs`.
|
|
20
|
+
More backends can be defined by separate libraries by extending the `FileSystem` class and providing a `Backend` object.
|
|
17
21
|
|
|
18
22
|
You can find all of the packages available over on [NPM](https://www.npmjs.com/org/zenfs).
|
|
19
23
|
|
|
20
|
-
As an added bonus, all ZenFS backends support synchronous operations.
|
|
24
|
+
As an added bonus, all ZenFS backends support synchronous operations.
|
|
25
|
+
Additionally, all of the backends included with the core are cross-platform.
|
|
21
26
|
|
|
22
27
|
For more information, see the [docs](https://zenfs.dev/core).
|
|
23
28
|
|
|
@@ -27,7 +32,9 @@ For more information, see the [docs](https://zenfs.dev/core).
|
|
|
27
32
|
npm install @zenfs/core
|
|
28
33
|
```
|
|
29
34
|
|
|
30
|
-
If you're using ZenFS, especially for big projects, please consider supporting the project.
|
|
35
|
+
If you're using ZenFS, especially for big projects, please consider supporting the project.
|
|
36
|
+
Thousands of hours have been dedicated to its development.
|
|
37
|
+
Your acknowledgment or financial support would go a long way toward improving ZenFS and its community.
|
|
31
38
|
|
|
32
39
|
## Usage
|
|
33
40
|
|
|
@@ -149,7 +156,7 @@ fs.umount('/mnt/zip'); // finished using the zip
|
|
|
149
156
|
|
|
150
157
|
### Devices and device files
|
|
151
158
|
|
|
152
|
-
ZenFS includes
|
|
159
|
+
ZenFS includes support for device files. These are designed to follow Linux's device file behavior, for consistency and ease of use. You can automatically add some normal devices with the `addDevices` configuration option:
|
|
153
160
|
|
|
154
161
|
```ts
|
|
155
162
|
await configure({
|
|
@@ -208,9 +215,9 @@ A huge thank you to [![Deco.cx logo](https://avatars.githubusercontent.com/deco-
|
|
|
208
215
|
|
|
209
216
|
## Building
|
|
210
217
|
|
|
211
|
-
- Make sure you have Node and NPM installed. You must have Node
|
|
218
|
+
- Make sure you have Node and NPM installed. You must have Node v22 or newer.
|
|
212
219
|
- Install dependencies with `npm install`
|
|
213
|
-
- Build using `npm run build`
|
|
220
|
+
- Build using `npx tsc` or `npm run build`
|
|
214
221
|
- You can find the built code in `dist`.
|
|
215
222
|
|
|
216
223
|
### Testing
|