std/wasi
William Perron 69f3d67cb2
chore: remove Promise<void> return type annotation (#819)
There's a couple of instances where `Promise<void>` is still there,
those are the exceptions, for example functions that explicitely return
a `Promise` object or functions that return the promise from another
function call without any `await` statement.

used this one-liner to automatically remove everything:

```bash
grep -rli 'promise<void>' | xargs sed -i 's/: Promise<void>//g
```
2021-04-05 07:49:05 -04:00
..
testdata@aa121de88d chore: remove Promise<void> return type annotation (#819) 2021-04-05 07:49:05 -04:00
README.md feat(wasi): add start method to Context (denoland/deno#8141) 2021-02-01 10:46:58 +00:00
snapshot_preview1_test_runner.ts update copyright to 2021 (denoland/deno#9081) 2021-02-01 10:46:59 +00:00
snapshot_preview1_test.ts feat: add io/buffer and io/util module (#808) 2021-03-22 22:45:35 +01:00
snapshot_preview1.ts refactor: fix codes to pass no-unused-vars lint (#764) 2021-03-02 15:31:37 +09:00

wasi

This module provides an implementation of the WebAssembly System Interface.

Supported Syscalls

wasi_snapshot_preview1

  • args_get
  • args_sizes_get
  • environ_get
  • environ_sizes_get
  • clock_res_get
  • clock_time_get
  • fd_advise
  • fd_allocate
  • fd_close
  • fd_datasync
  • fd_fdstat_get
  • fd_fdstat_set_flags
  • fd_fdstat_set_rights
  • fd_filestat_get
  • fd_filestat_set_size
  • fd_filestat_set_times
  • fd_pread
  • fd_prestat_get
  • fd_prestat_dir_name
  • fd_pwrite
  • fd_read
  • fd_readdir
  • fd_renumber
  • fd_seek
  • fd_sync
  • fd_tell
  • fd_write
  • path_create_directory
  • path_filestat_get
  • path_filestat_set_times
  • path_link
  • path_open
  • path_readlink
  • path_remove_directory
  • path_rename
  • path_symlink
  • path_unlink_file
  • poll_oneoff
  • proc_exit
  • proc_raise
  • sched_yield
  • random_get
  • sock_recv
  • sock_send
  • sock_shutdown

Usage

import Context from "https://deno.land/std@$STD_VERSION/wasi/snapshot_preview1.ts";

const context = new Context({
  args: Deno.args,
  env: Deno.env.toObject(),
});

const binary = await Deno.readFile("path/to/your/module.wasm");
const module = await WebAssembly.compile(binary);
const instance = await WebAssembly.instantiate(module, {
  "wasi_snapshot_preview1": context.exports,
});

context.start(instance);