Skip to content

EasyCompressor is an open-source compression abstraction library that supports and implements many compression algorithms such as Zstd, LZMA, LZ4, Snappy, Brotli, GZip and Deflate. It is very useful for using along with distributed caching or storing files in database.

master
Go to file
Code

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 
 
 

README.md

NuGet License: MIT Build Status

EasyCompressor

EasyCompressor is an open-source compression abstraction library that supports and implements many compression algorithms such as Zstd, LZMA, LZ4, Snappy, Brotli, GZip and Deflate. It is very useful for using along with distributed caching or storing files in database.

Nuget Packages

Package Name Version Description
EasyCompressor Contains GZip, Deflate and (Brotli available only in .NETCore2.1, .NETStandard2.1 and above)
EasyCompressor.BrotliNET Contains Brotli using Brotli.NET (for erlier than .NETCore2.1, .NETStandard2.1)
EasyCompressor.LZ4 Contains LZ4 using K4os.Compression.LZ4
EasyCompressor.LZMA Contains LZMA using LZMA-SDK
EasyCompressor.Snappy Contains Snappy using Snappy.Standard
EasyCompressor.Zstd Contains Zstd (ZStandard) using ZstdNet
EasyCaching.Extensions.EasyCompressor This integrates EasyCaching with EasyCompressor. (How to use)

Note :

LZ4, GZip, Deflate, Brotli, and LZMA are cross-platform because these are complete implementations with C#. (also BrotliNet too because this is a wrapper of brotli native library for win/linux/osx)

But Zstd and Snappy are not cross-platform, because they are just a wrapper of the native library for windows.

Features

  • Supports and Implements many compression algorithms.
  • Supports async/await and CancellationToken.
  • Supports woking with multiple compressor with specified name
  • Supports Stream as most as possible (depending on the underlying library)
  • Compress/Decompress between byte[], Stream, StreamReader and StreamWriter.

Get Started

1. Install Package

PM> Install-Package EasyCompressor.LZ4

2. Add Services

public void ConfigureServices(IServiceCollection services)
{
    //...
    services.AddLZ4Compressor();

    //or services.AddGZipCompressor();      package : EasyCompressor
    //or services.AddDeflateCompressor();   package : EasyCompressor
    //or services.AddBrotliCompressor();    package : EasyCompressor
    //or services.AddBrotliNetCompressor(); package : EasyCompressor.BrotliNET
    //or services.AddZstdCompressor();      package : EasyCompressor.Zstd
    //or services.AddLZMACompressor();      package : EasyCompressor.LZMA
    //or services.AddSnappyCompressor();    package : EasyCompressor.Snappy
}

3. Use it

using EasyCompressor;

//Inject (ICompressor compressor)

//Compress
var compressedBytes = compressor.Compress(inputBytes);

//Decompress
var uncompressedBytes = compressor.Decompress(compressedBytes);

Benchmark

Benchmark

Contributing

Create an issue if you find a BUG or have a Suggestion or Question. If you want to develop this project :

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request

Give a Star! ⭐️

If you find this repository useful, please give it a star. Thanks!

License

EasyCompressor is Copyright © 2020 Mohammd Javad Ebrahimi under the MIT License.

About

EasyCompressor is an open-source compression abstraction library that supports and implements many compression algorithms such as Zstd, LZMA, LZ4, Snappy, Brotli, GZip and Deflate. It is very useful for using along with distributed caching or storing files in database.

Topics

Resources

License

Packages

No packages published
You can’t perform that action at this time.