File tree Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -57,6 +57,7 @@ module.exports = {
5757 'doc/api/module.md' ,
5858 'doc/api/modules.md' ,
5959 'doc/api/packages.md' ,
60+ 'doc/api/wasi.md' ,
6061 'test/es-module/test-esm-type-flag.js' ,
6162 'test/es-module/test-esm-type-flag-alias.js' ,
6263 '*.mjs' ,
Original file line number Diff line number Diff line change @@ -11,9 +11,9 @@ specification. WASI gives sandboxed WebAssembly applications access to the
1111underlying operating system via a collection of POSIX-like functions.
1212
1313``` 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+
1717const wasi = new WASI ({
1818 args: process .argv ,
1919 env: process .env ,
@@ -23,12 +23,10 @@ const wasi = new WASI({
2323});
2424const importObject = { wasi_snapshot_preview1: wasi .wasiImport };
2525
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);
2928
30- wasi .start (instance);
31- })();
29+ wasi .start (instance);
3230```
3331
3432To run the above example, create a new WebAssembly text format file named
You can’t perform that action at this time.
0 commit comments