@componentor/fs 1.2.0 → 1.2.2

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 (2) hide show
  1. package/README.md +12 -19
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -13,7 +13,7 @@
13
13
  - ⚡ **Isomorphic Git Ready** - Perfect companion for browser-based Git operations
14
14
  - 🔗 **Symlink Support** - Full symbolic link emulation for advanced file operations
15
15
  - 📦 **Zero Dependencies** - Lightweight and efficient
16
- - ✅ **Fully Tested** - 199 comprehensive tests with 100% pass rate
16
+ - ✅ **Fully Tested** - 214 comprehensive tests with 100% pass rate
17
17
  - 📁 **Full fs Compatibility** - access, appendFile, copyFile, cp, rm, truncate, open, opendir, streams, and more
18
18
  - 🚀 **Hybrid Mode** - Optimal performance with reads on main thread and writes on worker
19
19
 
@@ -64,13 +64,17 @@ The Origin Private File System API provides **direct access to the device's stor
64
64
  - **Optimized I/O**: Reduced serialization overhead compared to IndexedDB or localStorage
65
65
  - **Streaming Support**: Efficient handling of large files without memory constraints
66
66
 
67
- ### 📊 Performance Comparison
67
+ ### 📊 Performance vs LightningFS
68
68
 
69
- | Operation | localStorage | IndexedDB | OPFS-FS |
70
- |-----------|-------------|-----------|---------|
71
- | Small Files | ~50ms | ~20ms | **~5ms** |
72
- | Large Files | Memory limited | ~100ms | **~15ms** |
73
- | Directory Ops | Not supported | Complex | **Native** |
69
+ Benchmarked against [LightningFS](https://github.com/isomorphic-git/lightning-fs) (100 iterations):
70
+
71
+ | Operation | LightningFS | OPFS-FS (Hybrid) | Speedup |
72
+ |-----------|-------------|------------------|---------|
73
+ | Batch Writes | 25.57ms | 1.73ms | **14.8x faster** |
74
+ | Batch Reads | 12.64ms | 1.56ms | **8.1x faster** |
75
+ | Single Writes | 66.45ms | 71.37ms | ~1x |
76
+ | Single Reads | 66.76ms | 66.93ms | ~1x |
77
+ | **Total** | **172.85ms** | **144.30ms** | **1.20x faster** |
74
78
 
75
79
  > **Note:** This package was previously published as `@componentor/opfs-fs`. If you're upgrading, simply change your imports from `@componentor/opfs-fs` to `@componentor/fs`.
76
80
 
@@ -130,21 +134,10 @@ await fs.ready()
130
134
  await fs.writeFile('test.txt', 'Hello World') // Routed to worker
131
135
  const data = await fs.readFile('test.txt') // Routed to main thread
132
136
 
133
- // For long-running apps, periodically call gc() to prevent memory leaks
134
- await fs.gc()
135
-
136
137
  // Clean up when done
137
138
  fs.terminate()
138
139
  ```
139
140
 
140
- **Performance comparison** (100 iterations benchmark):
141
- | Mode | Average Time | vs LightningFS |
142
- |------|-------------|----------------|
143
- | Main Thread | ~175ms | ~1.0x |
144
- | Worker Only | ~145ms | 1.19x faster |
145
- | **Hybrid** | **~144ms** | **1.20x faster** |
146
- | LightningFS | ~173ms | baseline |
147
-
148
141
  ### File Operations
149
142
 
150
143
  #### `readFile(path, options?)`
@@ -706,7 +699,7 @@ npm run test:watch
706
699
  ```
707
700
 
708
701
  **Test Coverage:**
709
- - ✅ 199 tests with 100% pass rate
702
+ - ✅ 214 tests with 100% pass rate
710
703
  - ✅ File read/write operations (text and binary)
711
704
  - ✅ Directory operations (create, remove, list)
712
705
  - ✅ File metadata and statistics
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@componentor/fs",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "A blazing-fast, Node.js-compatible filesystem for the browser using OPFS",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",