Ogu.AspNetCore.Compressions.Snappy
2.1.0
dotnet add package Ogu.AspNetCore.Compressions.Snappy --version 2.1.0
NuGet\Install-Package Ogu.AspNetCore.Compressions.Snappy -Version 2.1.0
<PackageReference Include="Ogu.AspNetCore.Compressions.Snappy" Version="2.1.0" />
<PackageVersion Include="Ogu.AspNetCore.Compressions.Snappy" Version="2.1.0" />
<PackageReference Include="Ogu.AspNetCore.Compressions.Snappy" />
paket add Ogu.AspNetCore.Compressions.Snappy --version 2.1.0
#r "nuget: Ogu.AspNetCore.Compressions.Snappy, 2.1.0"
#addin nuget:?package=Ogu.AspNetCore.Compressions.Snappy&version=2.1.0
#tool nuget:?package=Ogu.AspNetCore.Compressions.Snappy&version=2.1.0
Ogu.AspNetCore.Compressions.Snappy
This library extends ASP.NET Core’s native compression capabilities with snappy compression provider which not included in the core framework
Adding Package
dotnet add package Ogu.AspNetCore.Compressions.Snappy
Usage
Registering provider:
The server decides which compression provider to use based on the client's Accept-Encoding
header. For example, if a client sends Accept-Encoding: gzip, br, zstd, snappy
, the server will select the first supported encoding in the list.
In the example below, since only the SnappyCompressionProvider
is registered, the server will respond using Snappy (snappy
) compression.
It is the caller’s responsibility to handle the response correctly.
The server includes the actual encoding used in the Content-Encoding
header — in this case, it will be snappy
.
services.AddResponseCompression(opts =>
{
opts.Providers.Add<SnappyCompressionProvider>();
opts.MimeTypes = ResponseCompressionDefaults.MimeTypes;
opts.EnableForHttps = true;
});
If the client requests encodings that the server does not support (e.g., Accept-Encoding: gzip, br
), compression will not occur, and the response will be sent uncompressed.
[!NOTE]
opts.MimeTypes
defines which responseContent-Type
s are eligible for compression. In this example, it uses the defaults provided byResponseCompressionDefaults.MimeTypes
(e.g.,text/plain
,application/json
, etc.).
Adding the Middleware
The last step is to add the response compression middleware to the pipeline, so it can automatically handle compression for outgoing responses.
app.UseResponseCompression();
Once added, the server will compress eligible responses based on the client’s Accept-Encoding
header and the registered compression providers.
[!IMPORTANT]
Middleware must be registered in the correct order.
For more details, refer to the official middleware documentation.
Links:
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 is compatible. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETCoreApp 3.1
- Ogu.AspNetCore.Compressions.Abstractions (>= 2.1.0)
- Ogu.Compressions.Snappy (>= 2.1.0)
-
.NETStandard 2.0
- Ogu.AspNetCore.Compressions.Abstractions (>= 2.1.0)
- Ogu.Compressions.Snappy (>= 2.1.0)
-
.NETStandard 2.1
- Ogu.AspNetCore.Compressions.Abstractions (>= 2.1.0)
- Ogu.Compressions.Snappy (>= 2.1.0)
-
net5.0
- Ogu.AspNetCore.Compressions.Abstractions (>= 2.1.0)
- Ogu.Compressions.Snappy (>= 2.1.0)
-
net6.0
- Ogu.AspNetCore.Compressions.Abstractions (>= 2.1.0)
- Ogu.Compressions.Snappy (>= 2.1.0)
-
net7.0
- Ogu.AspNetCore.Compressions.Abstractions (>= 2.1.0)
- Ogu.Compressions.Snappy (>= 2.1.0)
-
net8.0
- Ogu.AspNetCore.Compressions.Abstractions (>= 2.1.0)
- Ogu.Compressions.Snappy (>= 2.1.0)
-
net9.0
- Ogu.AspNetCore.Compressions.Abstractions (>= 2.1.0)
- Ogu.Compressions.Snappy (>= 2.1.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Ogu.AspNetCore.Compressions.Snappy:
Package | Downloads |
---|---|
Ogu.AspNetCore.Compressions
This library extends ASP.NET Core’s native compression capabilities with additional options not included in the core framework |
GitHub repositories
This package is not used by any popular GitHub repositories.