Sign in

    vfs

    Cross-platform virtual filesystem with pluggable backends

    vfs
    filesystem
    indexeddb
    wasi
    Download zip
    Author
    Version
    0.2.2
    License
    Apache-2.0
    Last updated
    6 months ago
    Downloads
    63

    mizchi/vfs does not have a README file

    FileSystem

    pub(open) trait FileSystem {
    async mkdir_p(Self, String) -> Unit raise VfsError
    async write_file(Self, String, Bytes) -> Unit raise VfsError
    async write_string(Self, String, String) -> Unit raise VfsError
    async remove_file(Self, String) -> Unit raise VfsError
    async remove_dir(Self, String) -> Unit raise VfsError
    }

    Core filesystem trait for write operations.

    Flushable

    pub(open) trait Flushable {
    async flush(Self) -> Unit raise VfsError
    async sync(Self) -> Unit raise VfsError
    dirty(Self) -> Bool
    }

    Trait for backends with buffered writes.

    ReadableFileSystem

    pub(open) trait ReadableFileSystem {
    async read_file(Self, String) -> Bytes raise VfsError
    async readdir(Self, String) -> Array[String] raise VfsError
    async is_dir(Self, String) -> Bool
    async is_file(Self, String) -> Bool
    }

    Core filesystem trait for read operations.

    Snapshottable

    pub(open) trait Snapshottable {
    async export_snapshot(Self) -> Snapshot
    async replace_snapshot(Self, Snapshot) -> Unit raise VfsError
    }

    Trait for backends that support snapshot export/import.

    VfsError

    pub suberror VfsError {
    VfsError(String)
    }

    VFS error type.

    VfsError::to_string

    fn VfsError::to_string(self : VfsError) -> String

    Snapshot

    pub struct Snapshot {
    dirs : Array[String]
    files : Array[SnapshotFile]
    } derive(Eq, Show)

    Full snapshot of a filesystem state.

    SnapshotFile

    pub struct SnapshotFile {
    path : String
    data : Bytes
    } derive(Eq, Show)

    Snapshot file entry for bulk export/import.

    VfsEvent

    pub enum VfsEvent {
    Write(String)
    Remove(String)
    Mkdir(String)
    } derive(Eq, Show)

    Event types for inter-tab notification.

    snapshot

    fn snapshot(dirs : Array[String], files : Array[SnapshotFile]) -> Snapshot

    Helper to create Snapshot.

    snapshot_file

    fn snapshot_file(path : String, data : Bytes) -> SnapshotFile

    Helper to create SnapshotFile.

    vfs_error

    fn vfs_error(msg : String) -> VfsError

    Helper to create VfsError from other packages.

    Source Files

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io