mirror of
https://github.com/denoland/deno.git
synced 2024-12-30 11:16:38 -05:00
20 lines
478 B
JavaScript
20 lines
478 B
JavaScript
|
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
|