VersaTul.Compression
1.0.16
Prefix Reserved
dotnet add package VersaTul.Compression --version 1.0.16
NuGet\Install-Package VersaTul.Compression -Version 1.0.16
<PackageReference Include="VersaTul.Compression" Version="1.0.16" />
paket add VersaTul.Compression --version 1.0.16
#r "nuget: VersaTul.Compression, 1.0.16"
// Install VersaTul.Compression as a Cake Addin #addin nuget:?package=VersaTul.Compression&version=1.0.16 // Install VersaTul.Compression as a Cake Tool #tool nuget:?package=VersaTul.Compression&version=1.0.16
VersaTul Compression
The VersaTul Compression project provides functionality to compress and decompress streams. It is built around the .NET System.IO.Compression classes, making it easy to work with compressed data. Let's dive into the details:
Features
- Stream Compression: The project enables you to compress and decompress streams efficiently. It uses the built-in
ZipStream
class to quickly compressMemoryStreams
into archive streams.
Usage
To use the VersaTul Compression project, follow these steps:
Install the Package: You can install the
VersaTul.Compression
package from NuGet using the following command:PM> NuGet\Install-Package VersaTul.Compression --version 1.0.14
Create a Compressed Stream:
- Use the
ZipStream
class to compress aMemoryStream
containing your data. - The compressed stream can be stored or transmitted efficiently.
- Use the
Decompress the Stream:
- When needed, decompress the stream using the same
ZipStream
class. - Retrieve the original data from the decompressed stream.
- When needed, decompress the stream using the same
Example
Here's a simple example of compressing and decompressing a stream:
using System.IO;
using VersaTul.Compression;
class Program
{
static void Main()
{
// Create some sample data
byte[] originalData = Encoding.UTF8.GetBytes("Hello, this is some data to compress!");
// Compress the data
using (var compressedStream = new MemoryStream())
{
using (var zipStream = new ZipStream(compressedStream, CompressionMode.Compress))
{
zipStream.Write(originalData, 0, originalData.Length);
}
// Store or transmit the compressed stream
// ...
// Decompress the stream
using (var decompressedStream = new MemoryStream())
{
using (var unzipStream = new ZipStream(compressedStream, CompressionMode.Decompress))
{
unzipStream.CopyTo(decompressedStream);
}
// Retrieve the original data
byte[] decompressedData = decompressedStream.ToArray();
string originalText = Encoding.UTF8.GetString(decompressedData);
Console.WriteLine($"Decompressed data: {originalText}");
}
}
}
}
License
This project is licensed under the MIT License. See the LICENSE file for 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 is compatible. |
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on VersaTul.Compression:
Package | Downloads |
---|---|
VersaTul.Collection.Streamers
The VersaTul Collection Streamers provides functionality that enables developers to quickly convert a collection of objects in memory into a data-reader that can be used for Bulk inserting data into a SQL Database, or be used to generate flat files. Developers can use the streamers to: 1. Convert a Collection to a Data-Reader. 2. Convert from a Data-Reader to other file formats such as CSV, TAB or Json. 3. Compress converted data into Zip files. 4. Transport the converted data via e-mail. The Streamers project also works with Display Attributes which is used to manipulate the properties on the objects in the collection such as formatting the data or renaming the property with a desired display name. |
GitHub repositories
This package is not used by any popular GitHub repositories.