| Crates.io | oak-vfs |
| lib.rs | oak-vfs |
| version | 0.0.1 |
| created_at | 2026-01-23 02:17:27.582468+00 |
| updated_at | 2026-01-23 02:17:27.582468+00 |
| description | Virtual file system abstraction for the Oak framework, supporting disk and memory-based storage. |
| homepage | https://github.com/ygg-lang/oaks |
| repository | https://github.com/ygg-lang/oaks |
| max_upload_size | |
| id | 2063180 |
| size | 28,599 |
A high-performance Virtual File System (VFS) abstraction for the Oak ecosystem, supporting both disk and memory-based storage.
Oak VFS provides a unified interface for file operations, allowing the Oak framework to work seamlessly with physical files on disk or virtual files in memory. This is critical for IDEs and Language Servers where files may be modified in memory before being saved to disk.
Vfs trait for all file operations.DiskVfs: Real-time access to the physical filesystem.MemoryVfs: Ultra-fast, in-memory file storage for unsaved buffers or tests.tokio.Using the MemoryVfs:
use oak_vfs::{MemoryVfs, Vfs, WritableVfs};
let vfs = MemoryVfs::new();
vfs.write_file("file:///hello.rs", "fn main() {}".to_string());
if vfs.exists("file:///hello.rs") {
let source = vfs.get_source("file:///hello.rs").unwrap();
println!("Content: {}", source.text());
}
use oak_vfs::{DiskVfs, Vfs};
let vfs = DiskVfs::new();
if let Some(metadata) = vfs.metadata("file:///C:/projects/main.rs") {
println!("File size: {} bytes", metadata.len);
}
use oak_vfs::{Vfs, MemoryVfs};
use oak_core::source::Position;
let vfs = MemoryVfs::new();
vfs.write_file("test.txt", "Line 1\nLine 2".to_string());
let pos = vfs.offset_to_position("test.txt", 8).unwrap();
println!("Offset 8 is at Line: {}, Col: {}", pos.line, pos.character);
Oak VFS is the backbone of:
MemoryVfs to simulate file structures without disk I/O.Contributions are welcome! Please feel free to submit issues or pull requests.
Oak VFS - A solid foundation for file management 🚀