Corset 5.0.3

dotnet add package Corset --version 5.0.3                
NuGet\Install-Package Corset -Version 5.0.3                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Corset" Version="5.0.3" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Corset --version 5.0.3                
#r "nuget: Corset, 5.0.3"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Corset as a Cake Addin
#addin nuget:?package=Corset&version=5.0.3

// Install Corset as a Cake Tool
#tool nuget:?package=Corset&version=5.0.3                

Corset

.NET Publish Coverage Status

Corset is a library designed to simplify compression in .Net. By default it supports Deflate and GZip but can be expanded upon to support other types of compression.

Basic Usage

The library is designed to be as simple as possible to use. However you do need to register it with your service collection so it can find the compressors:

servicecollection.AddCorset();

Or if you are using Canister:

servicecollection.AddCanisterModules();

This line is required prior to using the extension methods for the first time. Once Canister is set up, you can call the extension methods provided:

string Data = "This is a bit of data that I want to compress";
string CompressedBase64String = Data.Compress();

The Compress extension method works on both strings and byte arrays. It will also allow you to specify which Encoding the string is using. By default it assumes a UTF8 encoding but this can be set as one of the parameters. The result from the Compress function will be either a Base64 string if it was called on a string or a byte array if you called the function on a byte array.

In order to Decompress the data, you simply call the Decompress extension method:

string CompressedData = "This is a bit of data that I want to compress".Compress();
string DecompressedData = CompressedData.Decompress();

Like the Compress extension, this method works on both strings and byte arrays. It allows you to specify which Encoding the string you want back should be in, if called on a string. By default it assumes a UTF8 encoding. The result from the Decompress function is either a string if called on a string, or a byte array if called on a byte array.

Adding Compression Types

The system loads the compressors at the beginning when Canister is initialized. In order to add your own compression type simply implement the ICompressor interface and pass the assembly it resides in to the Canister initialization line along with the Corset assembly. You may also wish to look at the CompressorBase class as it has some of the code needed already written and just requires you to write a Stream to do the actual compression.

Installation

The library is available via Nuget with the package name "Corset". To install it run the following command in the Package Manager Console:

Install-Package Corset

Build Process

In order to build the library you will require the following as a minimum:

  1. Visual Studio 2022

Other than that, just clone the project and you should be able to load the solution and build without too much effort.

Product 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 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
5.0.3 41 11/27/2024
5.0.2 42 11/26/2024
5.0.1 76 11/24/2024
5.0.0 81 11/22/2024
4.0.51 85 11/15/2024
4.0.50 92 11/11/2024
4.0.49 80 11/4/2024
4.0.48 75 10/29/2024
4.0.47 77 10/29/2024
4.0.46 88 10/14/2024
4.0.45 90 10/9/2024
4.0.44 130 8/22/2024
4.0.43 119 8/21/2024
4.0.42 56 8/1/2024
4.0.41 207 6/25/2024
4.0.40 105 6/17/2024
4.0.39 109 5/30/2024
4.0.38 137 5/6/2024
4.0.37 105 5/1/2024
4.0.36 102 5/1/2024
4.0.35 106 5/1/2024
4.0.34 118 4/29/2024
4.0.33 126 3/27/2024
4.0.32 104 3/14/2024
4.0.31 113 3/13/2024
4.0.30 121 3/6/2024
4.0.29 110 3/5/2024
4.0.28 111 2/26/2024
4.0.27 128 2/21/2024
4.0.26 122 2/19/2024
4.0.25 129 2/2/2024
4.0.24 114 1/29/2024
4.0.23 113 1/19/2024
4.0.22 188 12/11/2023
4.0.21 155 11/17/2023
4.0.20 102 11/16/2023
4.0.19 125 11/15/2023
4.0.18 138 11/7/2023
4.0.17 134 11/3/2023
4.0.16 149 10/31/2023
4.0.15 139 10/27/2023
4.0.14 148 9/18/2023
4.0.13 160 9/11/2023
4.0.12 153 9/5/2023
4.0.11 166 9/4/2023
4.0.10 189 8/31/2023
4.0.9 179 8/30/2023
4.0.8 168 8/29/2023
4.0.7 140 8/29/2023
4.0.6 166 8/8/2023
4.0.5 176 8/8/2023
4.0.4 157 8/4/2023
4.0.3 193 7/13/2023
4.0.2 178 7/12/2023
4.0.1 185 7/10/2023
3.0.4 533 1/11/2022
3.0.3 492 1/7/2021
3.0.2 505 9/13/2020
3.0.1 555 3/25/2020
3.0.0 600 12/23/2019
2.0.4 1,153 6/1/2018
2.0.3 1,051 5/22/2018
2.0.2 1,226 4/6/2018
2.0.0 1,076 1/2/2018
1.0.8 1,076 5/17/2017
1.0.7 1,070 3/22/2017
1.0.6 1,066 1/24/2017
1.0.5 1,077 12/9/2016
1.0.4 1,112 11/18/2016
1.0.3 1,067 11/18/2016
1.0.2 1,083 11/18/2016
1.0.1 1,065 11/18/2016