Corset 5.0.4
dotnet add package Corset --version 5.0.4
NuGet\Install-Package Corset -Version 5.0.4
<PackageReference Include="Corset" Version="5.0.4" />
paket add Corset --version 5.0.4
#r "nuget: Corset, 5.0.4"
// Install Corset as a Cake Addin #addin nuget:?package=Corset&version=5.0.4 // Install Corset as a Cake Tool #tool nuget:?package=Corset&version=5.0.4
Corset
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:
- 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 | 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 is compatible. |
-
net8.0
- Canister.IoC (>= 6.0.1)
-
net9.0
- Canister.IoC (>= 6.0.1)
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.4 | 84 | 12/6/2024 |
5.0.3 | 85 | 11/27/2024 |
5.0.2 | 82 | 11/26/2024 |
5.0.1 | 85 | 11/24/2024 |
5.0.0 | 91 | 11/22/2024 |
4.0.51 | 93 | 11/15/2024 |
4.0.50 | 100 | 11/11/2024 |
4.0.49 | 84 | 11/4/2024 |
4.0.48 | 81 | 10/29/2024 |
4.0.47 | 85 | 10/29/2024 |
4.0.46 | 97 | 10/14/2024 |
4.0.45 | 97 | 10/9/2024 |
4.0.44 | 136 | 8/22/2024 |
4.0.43 | 123 | 8/21/2024 |
4.0.42 | 62 | 8/1/2024 |
4.0.41 | 229 | 6/25/2024 |
4.0.40 | 113 | 6/17/2024 |
4.0.39 | 116 | 5/30/2024 |
4.0.38 | 141 | 5/6/2024 |
4.0.37 | 107 | 5/1/2024 |
4.0.36 | 104 | 5/1/2024 |
4.0.35 | 108 | 5/1/2024 |
4.0.34 | 120 | 4/29/2024 |
4.0.33 | 128 | 3/27/2024 |
4.0.32 | 109 | 3/14/2024 |
4.0.31 | 116 | 3/13/2024 |
4.0.30 | 123 | 3/6/2024 |
4.0.29 | 112 | 3/5/2024 |
4.0.28 | 115 | 2/26/2024 |
4.0.27 | 130 | 2/21/2024 |
4.0.26 | 125 | 2/19/2024 |
4.0.25 | 131 | 2/2/2024 |
4.0.24 | 117 | 1/29/2024 |
4.0.23 | 115 | 1/19/2024 |
4.0.22 | 190 | 12/11/2023 |
4.0.21 | 157 | 11/17/2023 |
4.0.20 | 106 | 11/16/2023 |
4.0.19 | 128 | 11/15/2023 |
4.0.18 | 140 | 11/7/2023 |
4.0.17 | 137 | 11/3/2023 |
4.0.16 | 153 | 10/31/2023 |
4.0.15 | 142 | 10/27/2023 |
4.0.14 | 150 | 9/18/2023 |
4.0.13 | 162 | 9/11/2023 |
4.0.12 | 157 | 9/5/2023 |
4.0.11 | 169 | 9/4/2023 |
4.0.10 | 191 | 8/31/2023 |
4.0.9 | 181 | 8/30/2023 |
4.0.8 | 170 | 8/29/2023 |
4.0.7 | 142 | 8/29/2023 |
4.0.6 | 170 | 8/8/2023 |
4.0.5 | 179 | 8/8/2023 |
4.0.4 | 160 | 8/4/2023 |
4.0.3 | 196 | 7/13/2023 |
4.0.2 | 181 | 7/12/2023 |
4.0.1 | 187 | 7/10/2023 |
3.0.4 | 537 | 1/11/2022 |
3.0.3 | 496 | 1/7/2021 |
3.0.2 | 509 | 9/13/2020 |
3.0.1 | 560 | 3/25/2020 |
3.0.0 | 604 | 12/23/2019 |
2.0.4 | 1,162 | 6/1/2018 |
2.0.3 | 1,060 | 5/22/2018 |
2.0.2 | 1,234 | 4/6/2018 |
2.0.0 | 1,085 | 1/2/2018 |
1.0.8 | 1,084 | 5/17/2017 |
1.0.7 | 1,078 | 3/22/2017 |
1.0.6 | 1,074 | 1/24/2017 |
1.0.5 | 1,086 | 12/9/2016 |
1.0.4 | 1,119 | 11/18/2016 |
1.0.3 | 1,074 | 11/18/2016 |
1.0.2 | 1,090 | 11/18/2016 |
1.0.1 | 1,072 | 11/18/2016 |