shortcuts/stat/mod.ts

22 lines
514 B
TypeScript
Raw Normal View History

2024-09-30 17:12:28 +00:00
import "../lib/wasm_tinygo.js";
2024-09-28 20:18:36 +00:00
import type { Stat } from "./types.ts";
2024-09-28 16:04:12 +00:00
2024-09-28 16:09:31 +00:00
// @ts-expect-error: no types
2024-09-28 16:04:12 +00:00
const go = new Go();
2024-09-28 16:09:31 +00:00
2024-09-28 16:04:12 +00:00
const code =
await (await fetch(import.meta.url.replace("/mod.ts", "/mod.wasm")))
.arrayBuffer();
2024-09-28 20:18:36 +00:00
2024-09-28 16:04:12 +00:00
const wasmMmodule = await WebAssembly.instantiate(code, go.importObject);
const wasm = wasmMmodule.instance;
2024-09-28 20:18:36 +00:00
2024-09-28 16:04:12 +00:00
go.run(wasm);
2024-09-28 20:18:36 +00:00
const _exports = {} as Record<string, (...args: unknown[]) => unknown> & Stat;
// @ts-ignore: no types
__InitStatExports(_exports);
export default _exports;