Atypical.VirtualFileSystem
0.2.0
See the version list below for details.
dotnet add package Atypical.VirtualFileSystem --version 0.2.0
NuGet\Install-Package Atypical.VirtualFileSystem -Version 0.2.0
<PackageReference Include="Atypical.VirtualFileSystem" Version="0.2.0" />
paket add Atypical.VirtualFileSystem --version 0.2.0
#r "nuget: Atypical.VirtualFileSystem, 0.2.0"
// Install Atypical.VirtualFileSystem as a Cake Addin #addin nuget:?package=Atypical.VirtualFileSystem&version=0.2.0 // Install Atypical.VirtualFileSystem as a Cake Tool #tool nuget:?package=Atypical.VirtualFileSystem&version=0.2.0
Virtual File System
A virtual file system implementation in modern C#.
📝 Table of Contents
- 📝 Table of Contents
- 📖 Introduction
- 📌 Features
- 📄 Documentation
- 📥 Installation
- 📚 Use cases
- 🤝 Contributing
- 📜 License
- 📬 Contact
- 🙌 Acknowledgements
- 🎉 Change log
- ✨ Contributors
📖 Introduction
When writing applications in .NET, you often need to write or read the contents of a file. .NET provides System.IO
namespace dedicated to this purpose. But how do we deal with the filesystem when testing our code?
Virtual File System is an attempt to solve this problem. Currently, this library is at an early stage of development. If you need additional functionality, I invite you to open an issue to discuss it.
🧐 What is a virtual file system and why should I use it?
A virtual file system is a data structure that represents a file system in memory. It is used to simulate a file system on a computer. It is useful for testing purposes, for example, when you want to test a file system without actually creating files on the hard drive.
📌 Features
- Create a virtual file system
- Create a virtual file or directory
- Print the contents of a virtual file system as a tree
- ...
📄 Documentation
Virtual File System provides a COMPLETE DOCUMENTATION of the library.
All summaries are written in English. If you want to help us translate the documentation, please open an issue to discuss it.
Note: The documentation is generated using Doraku/DefaultDocumentation tool. It is generated automatically when the project is built.
📥 Installation
📋 Prerequisites
- .NET 6.0
- A C# IDE (Visual Studio, Rider, etc.)
- A C# compiler (dotnet CLI, etc.)
🚀 We use the latest C# features
This library targets .NET 7.0 and uses the latest C# features. It is written in C# 11.0 and uses the new init
properties, record
types, switch
expressions, using
declarations, and more.
I invite you to read the C# 11.0 documentation to learn more about these features.
📦 NuGet
VirtualFileSystem is available on NuGet.
You can install it using the .NET Core CLI:
dotnet add package Atypical.VirtualFileSystem
or by adding a package reference to your project file:
<PackageReference Include="Atypical.VirtualFileSystem" Version="0.2.0" />
📁 From source
You can also clone the repository and build the project yourself.
git clone
cd VirtualFileSystem
dotnet build
📚 Use cases
Creating a virtual file system, add some files and print the content as an ASCII tree
// sample output (the order of the files is alphabetical)
string expected = """
vfs://
├── superheroes
│ ├── batman.txt
│ ├── superman.txt
│ └── wonderwoman.txt
├── villains
│ ├── joker.txt
│ ├── lexluthor.txt
│ └── penguin.txt
└── world
├── gotham.txt
├── metropolis.txt
└── themyscira.txt
""";
// create a virtual file system
IVirtualFileSystem vfs = new VFS()
// add some files (directories are created automatically)
.CreateFile("superheroes/batman.txt")
.CreateFile("superheroes/superman.txt")
.CreateFile("superheroes/wonderwoman.txt")
.CreateFile("villains/joker.txt")
.CreateFile("villains/lexluthor.txt")
.CreateFile("villains/penguin.txt")
.CreateFile("world/gotham.txt")
.CreateFile("world/metropolis.txt")
.CreateFile("world/themyscira.txt");
// get the string representation of the virtual file system
string tree = vfs.GetTree();
🤝 Contributing
Contributions are welcome! Please read the CONTRIBUTION GUIDELINES first.
📜 License
This project is licensed under the terms of the BSD-3-Clause license. If you use this library in your project, please consider adding a link to this repository in your project's README.
This project is maintained by Atypical Consulting. If you need help with this project, please contact us from this repository by opening an issue.
📬 Contact
You can contact us by opening an issue on this repository.
🙌 Acknowledgements
🎉 Change log
Please see RELEASES for more information what has changed recently.
✨ Contributors
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
-
net7.0
-
net8.0
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
## Changes
- Get a summary from the ToString method @phmatray (#35)
- Add some unit tests @phmatray (#34)
- Add method to IVirtualFileSystem + comments and test @phmatray (#33)
- Create Directory.Build.props @phmatray (#32)