vfs

Cross-platform virtual filesystem with pluggable backends

vfs
filesystem
indexeddb
wasi
moon add mizchi/vfs@0.2.3
Download zip
Author
Version
0.2.3
License
Apache-2.0
Last updated
18 hours ago
Downloads
34

Dependencies

README

mizchi/vfs does not have a README file

#
FileSystem

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

Core filesystem trait for write operations.

#
Flushable

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

Trait for backends with buffered writes.

#
ReadableFileSystem

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

Core filesystem trait for read operations.

#
Snapshottable

pub(open) trait Snapshottable {
async fn export_snapshot(Self) -> Snapshot
async fn 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,
Debug
)

Full snapshot of a filesystem state.
impl Show for Snapshot

#
SnapshotFile

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

Snapshot file entry for bulk export/import.

#
VfsEvent

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

Event types for inter-tab notification.
impl Show for VfsEvent

#
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