1 | import { u8aEq } from '../u8a/eq.js';
|
2 | import { isU8a } from './u8a.js';
|
3 | const WASM_MAGIC = new Uint8Array([0, 97, 115, 109]); // \0asm
|
4 | /**
|
5 | * @name isWasm
|
6 | * @summary Tests if the input has a WASM header
|
7 | * @description
|
8 | * Checks to see if the input Uint8Array contains a valid WASM header
|
9 | */
|
10 | export function isWasm(value) {
|
11 | return isU8a(value) && u8aEq(value.subarray(0, 4), WASM_MAGIC);
|
12 | }
|