sea: support sea.getRawAsset()

This patch adds support for `sea.getRawAsset()` which is
similar to `sea.getAsset()` but returns the raw asset
in an array buffer without copying. Users should avoid
writing to the returned array buffer. If the injected
section is not marked as writable or not aligned,
writing to the raw asset is likely to result in a crash.

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>
This commit is contained in:
Joyee Cheung 2023-11-28 18:58:15 +01:00
parent ce8f085d26
commit c307ad7686
No known key found for this signature in database
GPG key ID: 92B78A53C8303B8D
6 changed files with 131 additions and 0 deletions

View file

@ -71,5 +71,6 @@ function getAssetAsBlob(key, options) {
module.exports = {
isSea,
getAsset,
getRawAsset,
getAssetAsBlob,
};