Skip to content

Latest commit

 

History

History
62 lines (48 loc) · 3.43 KB

File metadata and controls

62 lines (48 loc) · 3.43 KB

Ramstack.FileSystem.Adapters

NuGet MIT

Provides an implementation of Ramstack.FileSystem for integrating with Microsoft.Extensions.FileProviders.

Getting Started

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

dotnet add package Ramstack.FileSystem.Adapters

Usage

using Microsoft.Extensions.FileProviders;
using Microsoft.Extensions.FileProviders.Physical;
using Ramstack.FileSystem.Adapters;

// Create a physical file provider that points to the specified directory
IFileProvider provider = new PhysicalFileProvider(@"C:\path");

// Create a virtual file system adapter that wraps the physical file provider.
//
// An added benefit is that now information about the entire file hierarchy is available
// for files and directories provided by the underlying provider.
IVirtualFileSystem fs = new VirtualFileSystemAdapter(provider);

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

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.