Need help with as-wasi?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

jedisct1
133 Stars 11 Forks MIT License 147 Commits 5 Opened issues

Description

An AssemblyScript API layer for WASI system calls.

Services available

!
?

Need anything else?

Contributors list

# 1,761
C
doh
zig
dns-ove...
77 commits
# 49,451
webasse...
assembl...
pico-8
Lua
12 commits
# 13,744
Rust
webasse...
wasm
React
11 commits
# 65,407
Angular
OCaml
webasse...
wasi
3 commits
# 31,644
Go
lambda
golang
functio...
2 commits
# 44,382
Rust
rust-la...
Socket....
wasi
1 commit

as-wasi

npm version npm downloads per month GitHub License

A high-level AssemblyScript layer for the WebAssembly System Interface (WASI). 🧩

WASI is an API providing access to the external world to WebAssembly modules. AssemblyScript exposes the low-level WASI standard set of system calls.

as-wasi
builds a higher level API on top of the AssemblyScript WASI interface, at a similar level to the Node API. 🚀

Installation

You can install

as-wasi
in your project by running the following:

npm install --save as-wasi

Quick Start

Example usage of the

Console
and
Environ
classes:
import "wasi";

// Import from the installed as-wasi package import { Console, Environ } from "as-wasi";

// Create an environ instance let env = new Environ();

// Get the HOME Environment variable let home = env.get("HOME")!;

// Log the HOME string to stdout Console.log(home);

Here are some exported classes that are commonly used:

  • FileSystem
    - Reading and Writing the user's fileystem. 📁
  • Console
    - General logging to stdout and stderr. 🖥️
  • Environ
    - Accessing environment variables, command flags, etc... 🌐
  • Date
    - Getting the current system time. 📅
  • Random
    - Accessing random numbers. 🤔
  • Time
    - Allow sleeping and waiting for events to occur. ⏰
  • And More! See the Reference API in the next section for the full API.

Reference API Docs

Reference API documentation can be found in REFERENCEAPIDOCS. Documentation is generated using typedoc.

Projects using as-wasi

  • wasmboy - Game Boy / Game Boy Color Emulator Library, 🎮written for WebAssembly using AssemblyScript. 🚀
  • wasmerio/io-devices-lib - Library for interacting with the Wasmer Experimental IO Devices API. Uses WASI for outputting graphics in a framebuffer, and handles mouse/keyboard input.
  • wasm-by-example - Wasm By Example is a website with a set of hands-on introduction examples and tutorials for WebAssembly (Wasm). Wasm By Example features
    as-wasi
    by default for the AssemblyScript WASI examples.
  • wasm-matrix - A Matrix effect in your terminal using AssemblyScript 🚀 and WASI 🧩 . This project is a bit older, and uses an older version of
    as-wasi
    , but still creates a cool effect!

If your project is using as-wasi, and you would like to be featured here. Please open a pull request against the README with links to your project, and if appropriate, explaining how as-wasi is being used. 😊

Contributing

Contributions are definitely welcome! Feel free to open a PR for small fixes such as typos and things. Larger fixes, or new features should start out as an issue for discussion, in which then a PR should be made. 🥳

This project will also adhere to the AssemblyScript Code of Conduct.

License

MIT. 📝

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.