UNDER CONSTRUCTION
This is a ~200KB "polyfill" that hosts an file system in memory, in pure wasm.
It is developed around a rust port I made of the v86 js emulator's file system.
All wasm file system WASI commands can be forwarded to this file system, allowing you to run web assembly programs that use the file system without giving it access to the file system.
Symlinks are supported!
Solutions like this exist for javascript, but this is pure rust -> pure wasm, which is more suitable for use cases outside the browser.
Every fd_ and path_. See The wasi reference
or the code for more information
rustup install nightly
rustup target add wasm32-unknown-unknown --toolchain nightly
cd rust
make
In progressff
Just use regular file system commands like you would in any other rust program, and then target wasm32-wasip1. That'll export any WASI file system commands you need, and you can connect them up to this wasm.
I wasn't able to find any suitable alternatives online.
- Emscripten's WASMFS seemed a sensible choice, so I previously wrote a port for it. However I couldn't get it working well, and it's missing quite a few features
- https://github.com/WebAssembly/wasi-filesystem is read-only
- https://github.com/wasm-forge/ic-wasi-polyfill is a wrapper for the internet computer (some crypto aws alternative), and isn't a standalone wasm
The following are rust, in memory file system alternatives that may be worth writing WASI wrappers for (but don't currently have WASI wrappers for them)
- https://github.com/gz/btfs
- https://github.com/GodTamIt/btrfs-diskformat
- https://github.com/twmb/rsfs
- https://github.com/andrewhalle/memfs
Other in memory file system implementations
- https://crates.io/crates/nine-memfs says is buggy :/
- https://github.com/golemfactory/sp-wasm/tree/master/sp-wasm-memfs
- https://github.com/phR0ze/rivia-vfs has a memory file system
- https://github.com/manuel-woelker/rust-vfs, though it says MemoryFS is intended mainly for unit tests
- https://github.com/cloudflare/workers-wasi soft and hard links not yet supported