summaryrefslogtreecommitdiff
path: root/cli/compilers/wasm_wrap.js
blob: 98892b8e0e093c5b19dc7d413a78d82c16974a11 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// @ts-nocheck
const importObject = Object.create(null);
//IMPORTS

function base64ToUint8Array(data) {
  const binString = window.atob(data);
  const size = binString.length;
  const bytes = new Uint8Array(size);
  for (let i = 0; i < size; i++) {
    bytes[i] = binString.charCodeAt(i);
  }
  return bytes;
}

const buffer = base64ToUint8Array("BASE64_DATA");
const compiled = await WebAssembly.compile(buffer);

const instance = new WebAssembly.Instance(compiled, importObject);

//EXPORTS