# as-wasi

Latest version **0.6.0** (published 2023-03-15) · 0 weekly downloads

## Install

```sh
npm install as-wasi
pnpm add as-wasi
yarn add as-wasi
bun add as-wasi
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.6.0 |
| Published | 2023-03-15 |
| First published | 2019-12-03 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 66.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | jedisct1 |

## Links

- npm: https://www.npmjs.com/package/as-wasi
- npm.io page: https://npm.io/package/as-wasi

## Dependencies (1)

- [@assemblyscript/wasi-shim](https://npm.io/package/@assemblyscript/wasi-shim.md) ^0.1

## Recent versions

- 0.6.0 (latest) — 2023-03-15
- 0.5.1 — 2022-09-01
- 0.5.0 — 2022-09-01
- 0.4.6 — 2021-07-02
- 0.4.5 — 2021-05-28
- 0.4.4 — 2020-11-29
- 0.4.3 — 2020-11-10
- 0.4.2 — 2020-11-10
- 0.4.1 — 2020-11-09
- 0.4.0 — 2020-10-26
- 0.3.0 — 2020-10-16
- 0.2.1 — 2020-10-07
- 0.2.0 — 2020-07-17
- 0.1.1 — 2020-05-18
- 0.0.1 — 2019-12-03

## README

# as-wasi

<!--- Badges -->

![npm version](https://img.shields.io/npm/v/as-wasi.svg)
![npm downloads per month](https://img.shields.io/npm/dm/as-wasi.svg)
![GitHub License](https://img.shields.io/github/license/torch2424/as-wasi.svg)

<!--- Short Description-->

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

[WASI](https://wasi.dev) 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](https://nodejs.org/docs/latest/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:

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

// 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 [REFERENCE_API_DOCS](./REFERENCE_API_DOCS.md). Documentation is generated using [typedoc](https://typedoc.org/).

## Projects using as-wasi

* [wasmboy](https://github.com/torch2424/wasmboy) - Game Boy / Game Boy Color Emulator Library, 🎮written for WebAssembly using AssemblyScript. 🚀
* [wasmerio/io-devices-lib](https://github.com/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](https://github.com/torch2424/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](https://github.com/torch2424/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](https://github.com/AssemblyScript/assemblyscript/blob/master/CODE_OF_CONDUCT.md).

## License

[MIT](https://oss.ninja/mit/jedisct1). 📝

---
_Source: https://npm.io/package/as-wasi · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
