* 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)
| 44 | * @returns {string|ArrayBuffer} |
| 45 | */ |
| 46 | function 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 |
no test coverage detected
searching dependent graphs…