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 } }
Install
dotnet add package Brotli.NET --version 2.0.4
Install-Package Brotli.NET -Version 2.0.4
<PackageReference Include="Brotli.NET" Version="2.0.4" />
Frameworks
Dependencies
Adoption guide
Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.
Compatibility metadata lists 4 target frameworks; confirm the exact target used by your application.
How to read this guidance
Sources: published NuGet v3 registry metadata and explicit NuBrowse editorial guides. Refresh: package metadata is refreshed from NuGet when the page loads. Limit: this is not a security, legal or compatibility guarantee; validate the selected version in your project.
Useful next steps
Move from package metadata to a concrete selection or review workflow.