CommonNetFuncs.Compression
1.0.42
See the version list below for details.
dotnet add package CommonNetFuncs.Compression --version 1.0.42
NuGet\Install-Package CommonNetFuncs.Compression -Version 1.0.42
<PackageReference Include="CommonNetFuncs.Compression" Version="1.0.42" />
<PackageVersion Include="CommonNetFuncs.Compression" Version="1.0.42" />
<PackageReference Include="CommonNetFuncs.Compression" />
paket add CommonNetFuncs.Compression --version 1.0.42
#r "nuget: CommonNetFuncs.Compression, 1.0.42"
#:package CommonNetFuncs.Compression@1.0.42
#addin nuget:?package=CommonNetFuncs.Compression&version=1.0.42
#tool nuget:?package=CommonNetFuncs.Compression&version=1.0.42
CommonNetFuncs.Compression
This project contains helper methods for compressing files into a zip file as well as compress and decompress streams.
Contents
Files
Used for compressing file data into a ZipArchive class.
<details> <summary><h3>Usage Examples</h3></summary>
Add file to zip folder and write it to disk.
using static CommonNetFuncs.Compression.Files;
using static CommonNetFuncs.Excel.Npoi.Export;
public async Task CreatePeopleZipFile()
{
List<Person> people = [];
//Some code populating people list here
await using MemoryStream zipStream = new();
//Converts list to excel file in a MemoryStream (see Excel.Npoi)
await using MemoryStream peopleExcelStream = await people.GenericExcelExport() ?? new();
await (peopleExcelStream, "People.xlsx").ZipFile(zipStream, CompressionLevel.SmallestSize);
peopleExcelStream.Dispose();
zipStream.Position = 0;
//Write the zip file to disk
await using FileStream fs = new("People.zip", FileMode.Create, FileAccess.Write);
await zipStream.CopyToAsync(fs);
fs.Flush();
}
Add multiple files to a ZipArchive object and write it to disk.
public async Task CreatePeopleAndAddressesZipFile()
{
List<Person> people = [];
List<Address> addresses = [];
//Some code populating people and addresses lists here
await using MemoryStream zipStream = new();
using ZipArchive archive = new(zipStream, ZipArchiveMode.Create, true);
//Convert lists to excel file in a MemoryStream (see Excel.Npoi) then add them to a ZipArchive
await using MemoryStream peopleExcelStream = await people.GenericExcelExport() ?? new();
await peopleExcelStream.AddFileToZip(archive, "People.xlsx", CompressionLevel.SmallestSize);
peopleExcelStream.Dispose();
await using MemoryStream addressesExcelStream = await addresses.GenericExcelExport() ?? new();
await addressesExcelStream.AddFileToZip(archive, "Addresses.xlsx", CompressionLevel.SmallestSize);
addressesExcelStream.Dispose();
archive.Dispose();
await using FileStream fs = new("PeopleAndAddresses.zip", FileMode.Create, FileAccess.Write);
await zipStream.CopyToAsync(fs);
fs.Flush();
}
</details>
Streams
Used for compressing and decompressing streams of data. Currently supported compression algorithms:
- Brotli
- GZip
- Deflate
- ZLib
<details> <summary><h3>Usage Examples</h3></summary>
Compress and then decompress a stream. CommonNetFuncs.Web.Requests has a more practical implementation decompressing compressed API responses.
public async Task CompressAndDecompressFile()
{
//Create stream
await using FileStream fileStream = new("TestFile.txt", FileMode.Open, FileAccess.Read);
//Compress the stream
await using MemoryStream compressedStream = new();
await fileStream.DecompressStream(compressedStream, ECompressionType.Gzip);
//Decompress the stream
await using MemoryStream decompressedStream = new();
await compressedStream.DecompressStream(decompressedStream, ECompressionType.Gzip);
}
</details>
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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 was computed. 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. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- CommonNetFuncs.Core (>= 1.0.42)
NuGet packages (5)
Showing the top 5 NuGet packages that depend on CommonNetFuncs.Compression:
| Package | Downloads |
|---|---|
|
CommonNetFuncs.Web.Aws.S3
Helper methods that deal with AWS S3 interactions |
|
|
CommonNetFuncs.Web.Requests
Helper methods that deal with creating, sending, and handling the responses from REST API calls |
|
|
CommonNetFuncs.Web.Common
Helper methods that deal with general web applications. |
|
|
CommonNetFuncs.Email
Helper methods that deal with sending email, including an SMTP email sending service and an HTML email builder helper. |
|
|
CommonNetFuncs.Web.Middleware
Misc middleware for ASP.NET MVC applications |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.0.40 | 0 | 5/10/2026 |
| 4.0.39 | 0 | 5/10/2026 |
| 4.0.37 | 55 | 5/9/2026 |
| 4.0.36 | 62 | 5/8/2026 |
| 4.0.31 | 189 | 4/21/2026 |
| 4.0.29 | 148 | 4/20/2026 |
| 4.0.28 | 137 | 4/19/2026 |
| 4.0.25 | 169 | 4/3/2026 |
| 4.0.17 | 211 | 2/23/2026 |
| 4.0.15 | 150 | 2/8/2026 |
| 4.0.14 | 160 | 2/7/2026 |
| 4.0.12 | 167 | 2/3/2026 |
| 4.0.10 | 163 | 1/24/2026 |
| 4.0.9 | 157 | 1/12/2026 |
| 3.8.42 | 227 | 3/5/2026 |
| 3.8.38 | 179 | 2/24/2026 |
| 3.8.33 | 227 | 2/2/2026 |
| 3.8.32 | 191 | 2/2/2026 |
| 1.0.42 | 236 | 11/12/2024 |