@ricsam/quickjs-fs 0.2.17 → 0.2.18
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/README.md +18 -7
- package/dist/cjs/package.json +1 -1
- package/dist/mjs/package.json +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
# @ricsam/quickjs-fs
|
|
2
2
|
|
|
3
|
-
File System Access API (OPFS-compatible).
|
|
3
|
+
File System Access API (OPFS-compatible) for QuickJS runtime.
|
|
4
|
+
|
|
5
|
+
> **Note**: This is a low-level package. For most use cases, use [`@ricsam/quickjs-runtime`](../runtime) with `createRuntime()` instead.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
bun add @ricsam/quickjs-fs
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Setup
|
|
4
14
|
|
|
5
15
|
```typescript
|
|
6
16
|
import { setupFs, createNodeDirectoryHandle } from "@ricsam/quickjs-fs";
|
|
@@ -16,12 +26,13 @@ const handle = setupFs(context, {
|
|
|
16
26
|
});
|
|
17
27
|
```
|
|
18
28
|
|
|
19
|
-
|
|
29
|
+
## Injected Globals
|
|
30
|
+
|
|
20
31
|
- `fs.getDirectory(path)` - Entry point for file system access
|
|
21
32
|
- `FileSystemDirectoryHandle`, `FileSystemFileHandle`
|
|
22
33
|
- `FileSystemWritableFileStream`
|
|
23
34
|
|
|
24
|
-
|
|
35
|
+
## Usage in QuickJS
|
|
25
36
|
|
|
26
37
|
```javascript
|
|
27
38
|
// Get directory handle
|
|
@@ -50,9 +61,9 @@ for await (const [name, handle] of root.entries()) {
|
|
|
50
61
|
}
|
|
51
62
|
```
|
|
52
63
|
|
|
53
|
-
|
|
64
|
+
## Host Adapters
|
|
54
65
|
|
|
55
|
-
|
|
66
|
+
### Node.js/Bun adapter
|
|
56
67
|
|
|
57
68
|
```typescript
|
|
58
69
|
import { createNodeDirectoryHandle } from "@ricsam/quickjs-fs";
|
|
@@ -60,7 +71,7 @@ import { createNodeDirectoryHandle } from "@ricsam/quickjs-fs";
|
|
|
60
71
|
const dirHandle = createNodeDirectoryHandle("/path/to/directory");
|
|
61
72
|
```
|
|
62
73
|
|
|
63
|
-
|
|
74
|
+
### In-memory adapter (for testing)
|
|
64
75
|
|
|
65
76
|
```typescript
|
|
66
77
|
import { createMemoryDirectoryHandle } from "@ricsam/quickjs-fs";
|
|
@@ -69,4 +80,4 @@ const memFs = createMemoryDirectoryHandle({
|
|
|
69
80
|
"config.json": JSON.stringify({ debug: true }),
|
|
70
81
|
"data/users.json": JSON.stringify([]),
|
|
71
82
|
});
|
|
72
|
-
```
|
|
83
|
+
```
|
package/dist/cjs/package.json
CHANGED
package/dist/mjs/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ricsam/quickjs-fs",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.18",
|
|
4
4
|
"main": "./dist/cjs/index.cjs",
|
|
5
5
|
"types": "./dist/types/index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"typecheck": "tsc --noEmit"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@ricsam/quickjs-core": "^0.2.
|
|
22
|
+
"@ricsam/quickjs-core": "^0.2.17",
|
|
23
23
|
"quickjs-emscripten": "^0.31.0"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|