NuGet Package Brotli.NET

Supported on dotnet standard2(Windows/Linux/OSX), provide similar interface to Google offical API.Quality and window control is supported.
The library use the native runtime and its performance should be better than System.IO.Compress.BrotliStream.
To support dynamic compress in web applications,add the code like this in the Global.asax.cs:
protected void Application_PostAcquireRequestState(object sender, EventArgs e)
{
var app = Context.ApplicationInstance;
String acceptEncodings = app.Request.Headers.Get("Accept-Encoding");

if (!String.IsNullOrEmpty(acceptEncodings))
{
System.IO.Stream baseStream = app.Response.Filter;
acceptEncodings = acceptEncodings.ToLower();

if (acceptEncodings.Contains("br") || acceptEncodings.Contains("brotli"))
{
app.Response.Filter = new BrotliStream(baseStream, System.IO.Compression.CompressionMode.Compress);
app.Response.AppendHeader("Content-Encoding", "br");
}
//other encodings
}
}.

Info

Version: 2.0.4.2
Author(s): Jinjun Xie
Last Update: Monday, March 4, 2019
.NET Fiddle: Create the first Fiddle
Project Url: https://github.com/XieJJ99/brotli.net
NuGet Url: https://www.nuget.org/packages/Brotli.NET


Install
Install-Package Brotli.NET
dotnet add package Brotli.NET
paket add Brotli.NET
Brotli.NET Download (Unzip the "nupkg" after downloading)

.NETFramework 3.5
  • No dependencies.
.NETFramework 4.0
  • No dependencies.
.NETFramework 4.5 .NETStandard 2.0
  • No dependencies.
3 packages depend on this package.


Tags



STATS

must-have-score

4.8

avg-downloads-per-day

117

days-since-last-release

224