Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemathinc
GitHub Repository: sagemathinc/wapython
Path: blob/main/core/wasi-js/src/bindings/browser.ts
1067 views
1
import { randomFillSync } from "randomfill";
2
import path from "path-browserify";
3
import hrtime from "./browser-hrtime";
4
import { WASIBindings, WASIExitError, WASIKillError } from "../types";
5
6
const bindings: WASIBindings = {
7
hrtime: hrtime.bigint,
8
exit: (code: number | null) => {
9
throw new WASIExitError(code);
10
},
11
kill: (signal: string) => {
12
throw new WASIKillError(signal);
13
},
14
randomFillSync,
15
isTTY: () => true,
16
path,
17
18
// Let the user attach the fs at runtime
19
fs: null,
20
};
21
22
export default bindings;
23
24