@@ -8864,92 +8864,12 @@ const { glob } = require('node:fs/promises');
88648864})();
88658865` ` `
88668866
8867- ### SEA (Single Executable Application) integration
8868-
8869- When running as a Single Executable Application, the VFS can automatically
8870- provide access to embedded assets through standard file system APIs.
8871-
8872- #### ` fs .hasSeaAssets ()`
8873-
8874- <!-- YAML
8875- added: REPLACEME
8876- -->
8877-
8878- * Returns: {boolean}
8879-
8880- Returns ` true ` if running as a SEA with embedded assets, ` false ` otherwise.
8881-
8882- ` ` ` cjs
8883- const fs = require (' node:fs' );
8884-
8885- if (fs .hasSeaAssets ()) {
8886- console .log (' Running as SEA with assets' );
8887- }
8888- ` ` `
8889-
8890- #### ` fs .getSeaVfs ([options])`
8891-
8892- <!-- YAML
8893- added: REPLACEME
8894- -->
8895-
8896- * ` options` {Object}
8897- * ` prefix` {string} Mount point prefix for SEA assets. **Default:** ` ' /sea' ` .
8898- * ` moduleHooks` {boolean} Whether to enable require/import hooks.
8899- **Default:** ` true ` .
8900- * Returns: {VirtualFileSystem|null}
8901-
8902- Returns a VFS populated with all SEA embedded assets, mounted at the specified
8903- prefix. Returns ` null ` if not running as a SEA or if there are no assets.
8904-
8905- The VFS is a singleton - subsequent calls return the same instance (options
8906- are only used on the first call).
8907-
8908- ` ` ` cjs
8909- const fs = require (' node:fs' );
8910-
8911- // In a SEA with an embedded 'config.json' asset:
8912- const seaVfs = fs .getSeaVfs ();
8913- if (seaVfs) {
8914- // Access embedded assets via standard fs APIs
8915- const config = fs .readFileSync (' /sea/config.json' , ' utf8' );
8916- console .log (JSON .parse (config));
8917-
8918- // Or require modules from embedded assets
8919- const utils = require (' /sea/utils.js' );
8920- }
8921- ` ` `
8922-
8923- To use SEA assets, first configure them in your SEA configuration file:
8924-
8925- ` ` ` json
8926- {
8927- " main" : " app.js" ,
8928- " output" : " app.blob" ,
8929- " assets" : {
8930- " config.json" : " path/to/config.json" ,
8931- " utils.js" : " path/to/utils.js"
8932- }
8933- }
8934- ` ` `
8935-
8936- Then access them via the VFS:
8937-
8938- ` ` ` cjs
8939- const fs = require (' node:fs' );
8940- const seaVfs = fs .getSeaVfs ();
8941-
8942- // Assets are accessible at /sea/<asset-key>
8943- const config = fs .readFileSync (' /sea/config.json' , ' utf8' );
8944- ` ` `
8945-
89468867### Limitations
89478868
89488869The current VFS implementation has the following limitations:
89498870
89508871* **Read-only**: Files can only be set via ` addFile ()` . Write operations
89518872 (` writeFile` , ` appendFile` , etc.) are not supported.
8952- * **No symbolic links**: Symbolic links are not supported.
89538873* **No file watching**: ` fs .watch ()` and ` fs .watchFile ()` do not work with
89548874 virtual files.
89558875* **No real file descriptor**: Virtual file descriptors (10000+) are managed
0 commit comments