File tree 2 files changed +7
-8
lines changed
2 files changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -57,6 +57,7 @@ module.exports = {
57
57
'doc/api/module.md' ,
58
58
'doc/api/modules.md' ,
59
59
'doc/api/packages.md' ,
60
+ 'doc/api/wasi.md' ,
60
61
'test/es-module/test-esm-type-flag.js' ,
61
62
'test/es-module/test-esm-type-flag-alias.js' ,
62
63
'*.mjs' ,
Original file line number Diff line number Diff line change @@ -11,9 +11,9 @@ specification. WASI gives sandboxed WebAssembly applications access to the
11
11
underlying operating system via a collection of POSIX-like functions.
12
12
13
13
``` js
14
- ' use strict ' ;
15
- const fs = require ( ' fs ' ) ;
16
- const { WASI } = require ( ' wasi ' );
14
+ import fs from ' fs ' ;
15
+ import { WASI } from ' wasi ' ;
16
+
17
17
const wasi = new WASI ({
18
18
args: process .argv ,
19
19
env: process .env ,
@@ -23,12 +23,10 @@ const wasi = new WASI({
23
23
});
24
24
const importObject = { wasi_snapshot_preview1: wasi .wasiImport };
25
25
26
- (async () => {
27
- const wasm = await WebAssembly .compile (fs .readFileSync (' ./demo.wasm' ));
28
- const instance = await WebAssembly .instantiate (wasm, importObject);
26
+ const wasm = await WebAssembly .compile (fs .readFileSync (' ./demo.wasm' ));
27
+ const instance = await WebAssembly .instantiate (wasm, importObject);
29
28
30
- wasi .start (instance);
31
- })();
29
+ wasi .start (instance);
32
30
```
33
31
34
32
To run the above example, create a new WebAssembly text format file named
You can’t perform that action at this time.
0 commit comments