MCPcopy Index your code
hub / github.com/GoogleChromeLabs/wasi-fs-access

github.com/GoogleChromeLabs/wasi-fs-access @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
123 symbols 217 edges 27 files 0 documented · 0% updated 27d ago★ 3483 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

wasi-fs-access

What

This is a demo shell powered by WebAssembly, WASI, Asyncify and File System Access API.

You can access the live version here: https://wasi.rreverser.com/

Or watch a video showing some of the features: Youtube recording

How

It provides WASI bindings implementation that proxies any filesystem requests to a real, host filesystem. This allows apps built in languages like C, C++, Rust and others to be compiled to WebAssembly and work as usual within a browser sandbox, accessing and manipulating files in a "real world".

Since WASI APIs are synchronous by nature, but Web APIs are traditionally asynchronous to avoid blocking the main thread, Asyncify is used to bridge the two types of APIs together. Asyncify is a feature created as part of Emscripten and later extended to work with arbitrary WebAssembly files with the help of a custom JavaScript wrapper.

A Rust port of coreutils with some patches was chosen for the demo purposes, but it should be possible to extract and reuse same bindings for any applications compiled for the WebAssembly + WASI target.

Note that some commands in the demo might not work due to either limitations of the WASI itself, limitations of the File System Access API (such as an absent support for symlinks), or simply due to hardcoded assumptions about the target system in the used coreutils codebase itself. Most of those limitations can be easily worked around or will be naturally fixed as both APIs develop over time.

Want to learn more?

Read up a blog post about Asyncify: https://web.dev/asyncify/

Or check out my presentation from the WebAssembly Live! here: https://www.slideshare.net/RReverser/asyncifying-webassembly-for-the-modern-web

And / or the talk: https://youtu.be/pzIJYAbcbf8?t=82

Extension points exported contracts — how you extend this code

In (Interface)
(no doc) [1 implementers]
src/bindings.ts
TypeDesc (Interface)
(no doc)
src/type-desc.ts
Out (Interface)
(no doc) [1 implementers]
src/bindings.ts

Core symbols most depended-on inside this repo

_getBuffer
called by 28
src/bindings.ts
get
called by 26
src/type-desc.ts
set
called by 25
src/type-desc.ts
struct
called by 10
src/type-desc.ts
std
called by 8
src/type-desc.ts
enumer
called by 8
src/type-desc.ts
write
called by 7
src/bindings.ts
getPreOpen
called by 7
src/fileSystem.ts

Shape

Method 49
Function 38
Class 22
Enum 11
Interface 3

Languages

TypeScript77%
C23%

Modules by API surface

src/bindings.ts41 symbols
src/fileSystem.ts37 symbols
src/type-desc.ts13 symbols
src/browser.ts4 symbols
tests/c/stat.c2 symbols
tests/c/poll.c2 symbols
tests/c/link.c2 symbols
tests/c/gettimeofday.c2 symbols
tests/c/getrusage.c2 symbols
tests/c/clock_getres.c2 symbols
tests/c/write_file.c1 symbols
tests/c/symlink_loop.c1 symbols

For agents

$ claude mcp add wasi-fs-access \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact