# vfs **Repository Path**: kentoqq/vfs ## Basic Information - **Project Name**: vfs - **Description**: 用rust实现的虚拟文件系统 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2025-07-10 - **Last Updated**: 2025-07-10 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # vfs A simple virtual file system implementation written in Rust. ## Introduction vfs is a virtual file system library that allows you to create and manipulate virtual files and directory structures in memory. This project is suitable for scenarios where you want to test file system operations without actual disk access or need to build in-memory file structures. ### Features - Create, read, write, and delete virtual files and directories. - Supports path resolution for operating on nested files and directories. - Provides metadata information for files and directories. - Supports changing the current working directory. ## Installation Make sure you have installed the [Rust toolchain](https://www.rust-lang.org/tools/install). Then, clone the repository and run: ```bash cargo build ``` ## Usage You can launch the interactive virtual file system by running: ```bash cargo run ``` This will start the CLI interface where you can perform various file system operations. ## Examples Here are some example commands you can run in the interactive environment: - Create a directory: `mkdir /path/to/directory` - Create a file and write content: `touch /path/to/file` - Read file content: `cat /path/to/file` - List all contents in the current directory: `ls` - Change the current working directory: `cd /path/to/directory` - Delete a file: `rm /path/to/file` - Delete a directory: `rmdir /path/to/directory` ## API ### `Vfs` The `Vfs` structure provides the main functionality of the virtual file system, including creating, reading, writing, and deleting files and directories, as well as path resolution. ### `VfsDirectory` The `VfsDirectory` structure represents a virtual directory and supports adding, retrieving, and deleting child nodes, as well as obtaining metadata. ### `VfsFile` The `VfsFile` structure represents a virtual file and supports reading and writing content, as well as obtaining metadata. ### `VfsNode` The `VfsNode` enum represents a node in the file system, which can be either a file or a directory. ### `VfsMetadata` The `VfsMetadata` structure represents metadata for a file or directory. ### `VfsError` The `VfsError` enum represents errors that may occur during operations. ## Contributions Code contributions and suggestions are welcome. Please submit Pull Requests to the project to add new features or improve existing code. ## License This project uses the MIT License. For details, please see the LICENSE file in the project.