mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
ce8f085d26
With this patch: Users can now include assets by adding a key-path dictionary to the configuration as the `assets` field. At build time, Node.js would read the assets from the specified paths and bundle them into the preparation blob. In the generated executable, users can retrieve the assets using the `sea.getAsset()` and `sea.getAssetAsBlob()` API. ```json { "main": "/path/to/bundled/script.js", "output": "/path/to/write/the/generated/blob.blob", "assets": { "a.jpg": "/path/to/a.jpg", "b.txt": "/path/to/b.txt" } } ``` The single-executable application can access the assets as follows: ```cjs const { getAsset } = require('node:sea'); // Returns a copy of the data in an ArrayBuffer const image = getAsset('a.jpg'); // Returns a string decoded from the asset as UTF8. const text = getAsset('b.txt', 'utf8'); // Returns a Blob containing the asset. const blob = getAssetAsBlob('a.jpg'); ``` Drive-by: update the documentation to include a section dedicated to the injected main script and refer to it as "injected main script" instead of "injected module" because it's a script, not a module. PR-URL: https://github.com/nodejs/node/pull/50960 Refs: https://github.com/nodejs/single-executable/issues/68 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> |
||
---|---|---|
.. | ||
assert | ||
dns | ||
fs | ||
inspector | ||
internal | ||
path | ||
readline | ||
stream | ||
test | ||
timers | ||
util | ||
_http_agent.js | ||
_http_client.js | ||
_http_common.js | ||
_http_incoming.js | ||
_http_outgoing.js | ||
_http_server.js | ||
_stream_duplex.js | ||
_stream_passthrough.js | ||
_stream_readable.js | ||
_stream_transform.js | ||
_stream_wrap.js | ||
_stream_writable.js | ||
_tls_common.js | ||
_tls_wrap.js | ||
.eslintrc.yaml | ||
assert.js | ||
async_hooks.js | ||
buffer.js | ||
child_process.js | ||
cluster.js | ||
console.js | ||
constants.js | ||
crypto.js | ||
dgram.js | ||
diagnostics_channel.js | ||
dns.js | ||
domain.js | ||
events.js | ||
fs.js | ||
http2.js | ||
http.js | ||
https.js | ||
inspector.js | ||
module.js | ||
net.js | ||
os.js | ||
path.js | ||
perf_hooks.js | ||
process.js | ||
punycode.js | ||
querystring.js | ||
readline.js | ||
repl.js | ||
sea.js | ||
stream.js | ||
string_decoder.js | ||
sys.js | ||
test.js | ||
timers.js | ||
tls.js | ||
trace_events.js | ||
tty.js | ||
url.js | ||
util.js | ||
v8.js | ||
vm.js | ||
wasi.js | ||
worker_threads.js | ||
zlib.js |