Skip to content

atwayne/sorted-directory-formatter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

General

A nuget package that provides a class SortedHtmlDirectoryFormatter derived from HtmlDirectoryFormatter Link, which will render the file list sorted by the LastModified property in descending order.

Usage

SortedHtmlDirectoryFormatter on fuget.org

dotnet add package SortedHtmlDirectoryFormatter
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
    app.UseDirectoryBrowser(new DirectoryBrowserOptions
    {
        FileProvider = new PhysicalFileProvider(rootDirectory),
        RequestPath = "/your-request-path",
        Formatter = new SortedHtmlDirectoryFormatter()
    });
}

Background

The extension method UseDirectoryBrowser generates a table that sorts the output by filename. This is not a super helpful behavior when it comes to some scenarios. e.g. Directory Browser on a folder full of files with random file names.

According to this github issue there is no plan to add a feature to sort this.

Hence I created this nuget package for this.

Another related github issue:
dotnet/aspnetcore#29539

About

HtmlDirectoryFormatter that sorts output file list by LastModified

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages