FileProviders.Zip
v2.0.1
ZIPファイルをASPNET CoreのStaticFilesミドルウェアのFSプロバイダーとして使用できます。この方法で使用すると、単一のzipファイルがルートファイルシステムとして機能します。
ASP.NETコアプロジェクトで、soukoku.extensions.fileproviders.zip nugetパッケージをインストールします。
ロードしたいzipファイルがあると仮定すると、次のようなことができます
// inside the Program.cs or Startup.cs
IApplicationBuilder app = .. .
var zipProvider = new ZipFileProvider ( @"pathtomyzip-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 ) ;
次に、ブラウザでURL http://mysite/testに移動して、zipファイルコンテンツを表示します。
サンプルASP.NETコアサイトは、古いpdf.js dist zipファイルを使用するソリューションに含まれています。それを実行するか、 Startup.csファイルを見て、その構成方法を確認してください。