UNPKG

550 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.isWasm = void 0;
4const eq_js_1 = require("../u8a/eq.js");
5const u8a_js_1 = require("./u8a.js");
6const WASM_MAGIC = new Uint8Array([0, 97, 115, 109]); // \0asm
7/**
8 * @name isWasm
9 * @summary Tests if the input has a WASM header
10 * @description
11 * Checks to see if the input Uint8Array contains a valid WASM header
12 */
13function isWasm(value) {
14 return (0, u8a_js_1.isU8a)(value) && (0, eq_js_1.u8aEq)(value.subarray(0, 4), WASM_MAGIC);
15}
16exports.isWasm = isWasm;