A Rust library for working with the Origin Private File System (OPFS) in WebAssembly applications.
- File and directory operations in OPFS
- Support for fuse.link files to create symbolic links between directories
- Package management functionality for handling npm-style dependencies
- Asynchronous API for all file operations
- Web applications that need persistent local storage
- Package managers for web-based development environments
- Applications that need to manage complex file structures in the browser
- Tools that require fast access to local files without user interaction
- Install Rust and Cargo
- Install wasm-pack:
cargo install wasm-pack - Build the project:
wasm-pack build - Run tests:
wasm-pack test --chrome --headless
opfs::read_dir(path)- Read directory contentsopfs::read(path)- Read file contentsopfs::write(path, content)- Write content to fileopfs::create_dir_all(path)- Create directory and all parent directoriesopfs::remove(path)- Remove a fileopfs::exists(path)- Check if file or directory exists
package_manager::install_deps(package_lock, max_concurrent_downloads)- Install dependencies from package-lock.json with specified concurrency limit
fuse::fuse_link(src, dst)- Create fuse link between source and destination directoriesfuse::read(path)- Read file content with fuse.link supportfuse::read_dir(path)- Read directory contents with fuse.link support
Tests are written using wasm-bindgen-test and can be run with:
wasm-pack test --chrome --headlessNote: Tests require a modern browser with OPFS support (Firefox 116+, Chrome 114+).
MIT