@@ -180,7 +180,7 @@ See documentation of the [`sea.getAsset()`][], [`sea.getAssetAsBlob()`][],
180180
181181> Stability: 1 - Experimental
182182
183- Instead of using the ` node:sea ` API to access individual assets, you can use
183+ In addition to using the ` node:sea ` API to access individual assets, you can use
184184the Virtual File System (VFS) to access bundled assets through standard ` fs `
185185APIs. To enable VFS, set ` "useVfs": true ` in the SEA configuration. When
186186enabled, the VFS is automatically initialized and mounted at ` /sea ` . All
@@ -205,42 +205,37 @@ if (fs.existsSync('/sea/optional.json')) {
205205}
206206```
207207
208- The VFS supports the following ` fs ` operations on bundled assets:
209-
210- * ` readFileSync() ` / ` readFile() ` / ` promises.readFile() `
211- * ` statSync() ` / ` stat() ` / ` promises.stat() `
212- * ` lstatSync() ` / ` lstat() ` / ` promises.lstat() `
213- * ` readdirSync() ` / ` readdir() ` / ` promises.readdir() `
214- * ` existsSync() `
215- * ` realpathSync() ` / ` realpath() ` / ` promises.realpath() `
216- * ` accessSync() ` / ` access() ` / ` promises.access() `
217- * ` openSync() ` / ` open() ` - for reading
218- * ` createReadStream() `
208+ The VFS supports all common ` fs ` operations for reading files and directories.
209+ Since the SEA VFS is read-only, write operations are not supported. See the
210+ [ VFS documentation] [ ] for the full list of supported and unsupported operations.
219211
220212#### Loading modules from VFS in SEA
221213
222- You can use ` require() ` directly with absolute VFS paths:
223-
224- ``` cjs
225- // Require bundled modules directly
226- const myModule = require (' /sea/lib/mymodule.js' );
227- const utils = require (' /sea/utils/helpers.js' );
228- ```
229-
230214When ` useVfs ` is enabled, ` require() ` in the injected main script uses the
231215registered module hooks to load modules from the virtual file system. This
232216supports both absolute VFS paths and relative requires (e.g.,
233- ` require('./helper.js') ` from a VFS module).
217+ ` require('./helper.js') ` from a VFS module), as well as ` node_modules ` package
218+ lookups.
219+
220+ ``` cjs
221+ // Require bundled modules using relative paths
222+ const myModule = require (' ./lib/mymodule.js' );
223+ const utils = require (' ./utils/helpers.js' );
224+
225+ // Absolute VFS paths also work
226+ const config = require (' /sea/config.json' );
227+ ```
234228
235229When ` useVfs ` is enabled, ` __filename ` and ` __dirname ` in the injected main
236230script reflect VFS paths (e.g., ` /sea/main.js ` ) instead of
237231[ ` process.execPath ` ] [ ] .
238232
239233#### Code caching limitations
240234
241- The ` useCodeCache ` option in the SEA configuration does not apply to modules
242- loaded from the VFS. Consider bundling the application to enable code caching
243- and do not rely on module loading in VFS.
235+ The ` useCodeCache ` option in the SEA configuration does not currently apply to
236+ modules loaded from the VFS. This is a current limitation due to incomplete
237+ implementation, not a technical impossibility. Consider bundling the application
238+ to enable code caching and do not rely on module loading in VFS.
244239
245240#### Native addon limitations
246241
@@ -721,6 +716,7 @@ to help us document them.
721716[Mach-O]: https://en.wikipedia.org/wiki/Mach-O
722717[PE]: https://en.wikipedia.org/wiki/Portable_Executable
723718[Using native addons in the injected main script]: # using-native-addons-in-the-injected-main-script
719+ [VFS documentation]: vfs.md
724720[Windows SDK]: https://developer.microsoft.com/en-us/windows/downloads/windows-sdk/
725721[` process.execPath` ]: process.md#processexecpath
726722[` require()` ]: modules.md#requireid
0 commit comments