Skip to content

Latest commit

 

History

History
57 lines (42 loc) · 2.91 KB

File metadata and controls

57 lines (42 loc) · 2.91 KB

Ramstack.FileSystem.Prefixed

Provides an implementation of Ramstack.FileSystem that adds a specified prefix to the file paths within the underlying file system.

Getting Started

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

dotnet add package Ramstack.FileSystem.Prefixed

Usage

using Ramstack.FileSystem.Prefixed;

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

// Make all original files and directories accessible with the "/public/assets" prefix,
// as if they were originally located at that path.
//
// As an example, a file originally at "/hello.txt" will be accessed as "/public/assets/hello.txt".

PrefixedFileSystem fs = new PrefixedFileSystem(prefix: "/public/assets", fileSystem);

await foreach (VirtualFile file in fs.GetFilesAsync("/public/assets"))
{
    Console.WriteLine(file.FullName);
}

Related Projects

Supported versions

Version
.NET 6, 7, 8, 9

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.