evfs is a Virtual File System written in Rust
The purpose of this library is to allow the user to setup a virtual file system that works similar to how a POSIX file system works. Here are some examples
vfs.mount("/temp", "/usr/foo/temp");
let handle = vfs.load_file("/temp/some_file");
The example above creates a mount /temp
that points to /usr/foo/temp
so when loading the file some_file
from /temp
it will actually load from /usr/foo/temp/some_file
vfs.mount("/assets", "data/data.zip");
let handle = vfs.load_file("/assets/main_menu.png");
In this code we mount a zip file and read a file from it. If at some point we don't want to use zip files anymore all of the code reading the data can stay the same and only the mount has to change.
vfs.mount("/music", "ftp://some_music_sever.com/music");
let handle = vfs.load_file("/music/awesome.flac");
evfs will (optionally) support loading over the net as well. In this case we read a file from an FTP server
evfs always uses async for loading but does not rely on Rust async
to keep things simple. When loading a file the user will always get a handle back and is responsible to check the status of it. It's also optionally possible to get the progress of how much a file has been loaded to allow updates in UIs and such.
Something that evfs also will support is to have different levels of caching. So for example files that happen to be read from a remote source can be cached locally. Still when using evfs you will still write the code as loading from a remote source, but if the file is present in the cache it will be loaded from there instead.
evfs is in very early development and isn't useable yet.
evfs is licensed under the MIT licence