Contains the source and tests of assembly System.IO.Compression, that includes types widely used on the compression space, as well as types for zip manipulation, and implementations of the Deflate, Gzip, and Zstandard algorithms.
Documentation can be found at https://learn.microsoft.com/dotnet/api/system.io.compression.
../../native/libs/System.IO.Compression.Native contains the PAL (Platform Abstraction Layer) of the zlib library used by System.IO.Compression.
Zstandard (zstd) compression and decompression is supported on all platforms except browser. The Zstandard source files are located in the Zstandard subdirectory.
ZstandardDictionary.Train returns raw dictionary bytes, which can be saved and distributed independently of compression or decompression:
byte[] dictionaryData = ZstandardDictionary.Train(samples, sampleLengths, maxDictionarySize);
File.WriteAllBytes("dictionary.zdict", dictionaryData);Load the bytes and call ZstandardDictionary.Create to prepare a reusable dictionary. Choose compression quality during preparation:
byte[] dictionaryData = File.ReadAllBytes("dictionary.zdict");
using ZstandardDictionary dictionary = ZstandardDictionary.Create(dictionaryData, quality: 19);A prepared dictionary's quality takes precedence over ZstandardCompressionOptions.Quality. Use the same dictionary bytes to prepare dictionaries for different qualities or for decompression; do not train again.
- We consider new features, new APIs and performance changes
- We consider PRs that target this library for new source code analyzers
See the Help Wanted issues.
System.IO.Compression is included in the shared framework. The package does not need to be installed into any project compatible with .NET Standard 2.0.