Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/soukoku/fileproviders.zip
Allows using zip files as FS provider for aspnet core's static files middleware.
https://github.com/soukoku/fileproviders.zip
aspnet fileprovider
Last synced: about 1 month ago
JSON representation
Allows using zip files as FS provider for aspnet core's static files middleware.
- Host: GitHub
- URL: https://github.com/soukoku/fileproviders.zip
- Owner: soukoku
- License: mit
- Created: 2017-11-12T18:14:48.000Z (about 7 years ago)
- Default Branch: main
- Last Pushed: 2024-09-08T14:05:54.000Z (4 months ago)
- Last Synced: 2024-10-08T18:12:38.348Z (3 months ago)
- Topics: aspnet, fileprovider
- Language: C#
- Homepage:
- Size: 3.26 MB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# About
Allows using zip files as a FS provider for aspnet core's
[StaticFiles middleware](https://github.com/dotnet/aspnetcore/tree/main/src/Middleware/StaticFiles).
A single zip file can serve as a root file system when used this way.# Getting It
In an asp.net core project, install the
[Soukoku.Extensions.FileProviders.Zip](https://www.nuget.org/packages/Soukoku.Extensions.FileProviders.Zip/)
NuGet package.# Example
Assuming there's a zip file you want to load, you can do something like the following```csharp
// inside the Program.cs or Startup.cs
IApplicationBuilder app = ...var zipProvider = new ZipFileProvider(@"path\to\my\zip-file.zip");
var options = new FileServerOptions
{
FileProvider = provider,
RequestPath = "/test", // optional
EnableDirectoryBrowsing = true,
};
// required for extension-less files
options.StaticFileOptions.ServeUnknownFileTypes = true;
app.UseFileServer(options);
```
Then go to the url `http://mysite/test` in the browser to see the zip file content.
# Sample Site
A sample asp.net core site is included in the solution that uses an old
[PDF.js](https://mozilla.github.io/pdf.js/) dist zip file.
Run it or look at the `Startup.cs` file to see how it's configured.