aboutsummaryrefslogtreecommitdiff
path: root/node_modules/nexe/lib/fs/README.md
diff options
context:
space:
mode:
authorMinteck <nekostarfan@gmail.com>2021-08-24 14:41:48 +0200
committerMinteck <nekostarfan@gmail.com>2021-08-24 14:41:48 +0200
commitd25e11bee6ca5ca523884da132d18e1400e077b9 (patch)
tree8af39fde19f7ed640a60fb397c7edd647dff1c4c /node_modules/nexe/lib/fs/README.md
downloadkartik-iridium-d25e11bee6ca5ca523884da132d18e1400e077b9.tar.gz
kartik-iridium-d25e11bee6ca5ca523884da132d18e1400e077b9.tar.bz2
kartik-iridium-d25e11bee6ca5ca523884da132d18e1400e077b9.zip
Initial commit
Diffstat (limited to 'node_modules/nexe/lib/fs/README.md')
-rw-r--r--node_modules/nexe/lib/fs/README.md40
1 files changed, 40 insertions, 0 deletions
diff --git a/node_modules/nexe/lib/fs/README.md b/node_modules/nexe/lib/fs/README.md
new file mode 100644
index 0000000..181c364
--- /dev/null
+++ b/node_modules/nexe/lib/fs/README.md
@@ -0,0 +1,40 @@
+# nexe-fs
+
+### Getting Started:
+
+This module contains a set of patches used to create (and use) the Nexe Virtual FileSystem
+
+In order for NVFS to work with node's `require` method. A custom build of node must be used. If using the `nexe` cli this will be handled automatically
+
+The customization should be applied as early as possbile when node is starting up.
+
+i.e. The contents of `nexe-fs/bootstrap` should be put [here](https://github.com/nodejs/node/blob/0827c80920311fa9d1e6989c8a73aaaeca962eb7/lib/internal/bootstrap/node.js#L27-L28).
+
+### Creating a NVFS:
+
+To create a virtual file system use the `Bundle` Object, in your build process:
+
+```javascript
+const { Bundle } = require('nexe-fs')
+
+const bundle = new Bundle()
+await bundle.addResource(absoluteFileName)
+
+bundle.toStream().pipe(fs.createWriteStream('./myFsBlob'))
+```
+
+In the entrypoint of your application, the fs patch needs to be applied (executed as early as possible)
+For example, In the build process, the application's entrypoint could be prepended with the following:
+
+```javascript
+const codeToPrependToEntrypoint = fs.readFileSync(require.resolve('nexe-fs/patch'), 'utf-8') + `
+shimFs({
+ blobPath: 'location/of/myFsBlob',
+ resources: ${JSON.stringify(bundle)},
+ layout: {
+ resourceStart: 0 // the offset within the blob that is referenced by the bundle index
+ }
+})`
+```
+
+Since a custom node build is being used. A great place for this code would be the node source file: `_third_party_main.js`