Skip to content

Latest commit

 

History

History
56 lines (42 loc) · 3.05 KB

File metadata and controls

56 lines (42 loc) · 3.05 KB

Ramstack.FileSystem.Readonly

NuGet MIT

Provides an implementation of Ramstack.FileSystem that wraps the underlying file system, preventing any destructive operations.

Getting Started

To install the Ramstack.FileSystem.Readonly NuGet package in your project, run the following command:

dotnet add package Ramstack.FileSystem.Readonly

Usage

using Ramstack.FileSystem.Readonly;

IVirtualFileSystem fileSystem = new PhysicalFileSystem(@"C:\path");
ReadonlyFileSystem fs = new ReadonlyFileSystem(fileSystem);

await foreach (VirtualFile file in fs.GetFilesAsync("/"))
{
    Console.WriteLine(node.Name);
}

// Throws an exception because the ReadonlyFileSystem does not support modifying operations
await fs.DeleteFileAsync("/hello.txt");

Related Projects

Supported versions

Version
.NET 6, 7, 8, 9, 10

Contributions

Bug reports and contributions are welcome.

License

This package is released as open source under the MIT License. See the LICENSE file for more details.