WASI Encap: Embedding Read-Only Filesystems in .wasm Blobs?

I found this project which looks promising:

GitHub - kateinoigakukun/wasi-vfs: A virtual filesystem layer for WASI.

It includes a tool which can pack a directory into a .wasm file, and then you can read that directory from within the Wasm code itself.

Right now it's not a priority to look into, given that I added BASIC-READ and BASIC-WRITE to the WASI build. If someone can prove the limit to using WASI effectively is that they have to distribute their project as a .zip and grant the runtime directory access (instead of as a single .wasm file) that seems like the time to attack it.

So... far future. :slight_smile:

emscripten File System Overview supports a similar virtual file system.

Emscripten and WASI don't really mix. They have a very bare bones support but appear to be mostly delegating it to wasi-sdk.

Emscripten people on the subject:

PURE_WASI option · Issue #12073 · emscripten-core/emscripten · GitHub

Really Emscripten should be used if you're building web things, and Wasi-SDK if you're building WASI.