MCPcopy Index your code
hub / github.com/nodejs/node / getAsset

Function getAsset

lib/sea.js:46–56  ·  view source on GitHub ↗

* Look for the asset in the injected SEA blob using the key. If the * encoding is specified, return a string decoded from it by TextDecoder, * otherwise return *a copy* of the original data in an ArrayBuffer. If * no matching asset is found an error is thrown. * @param {string} key * @param {st

(key, encoding)

Source from the content-addressed store, hash-verified

44 * @returns {string|ArrayBuffer}
45 */
46function getAsset(key, encoding) {
47 if (encoding !== undefined) {
48 validateString(encoding, 'encoding');
49 }
50 const asset = getRawAsset(key);
51 if (encoding === undefined) {
52 return ArrayBufferPrototypeSlice(asset);
53 }
54 const decoder = new TextDecoder(encoding);
55 return decoder.decode(asset);
56}
57
58/**
59 * Look for the asset in the injected SEA blob using the key. If

Callers 3

sea.jsFile · 0.85
sea.jsFile · 0.85

Calls 2

decodeMethod · 0.95
getRawAssetFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…