From time to time, the task is to pack something, unpack it, and simply make an automatic storage unit.
Collecting a selection of libraries:
1. SharpCompress
SharpCompress is a fully managed C# library to deal with many compression types and formats.
https://github.com/adamhathcock/sharpcompress
2. SevenZipSharp
Managed 7-zip library written in C# that provides data (self-)extraction and compression (all 7-zip formats are supported). It wraps 7z.dll or any compatible one and makes use of LZMA SDK.
https://archive.codeplex.com/?p=sevenzipsharp
3. SevenZipLib
SevenZipLib is a lightweight, easy-to-use managed interface to the 7-zip library.
https://archive.codeplex.com/?p=sevenziplib
4. Rar.exe – via the command line
There is an option – via the command line – rar.exe with parameters, their description in a file that comes with winrar.
5. 7z.dll – C# (.net) interface for 7-Zip archive dlls
7-Zip is open-source archive program with plug-in interface. New archive formats and/or archive codecs can be added by dlls. 7-Zip ships with several archive formats preinstalled:
- 7z – its own format features good compression (LZMA, PPMd) but can be slow in terms of packing/unpacking
- Packing / unpacking: ZIP, GZIP, BZIP2 and TAR
- Unpacking only: RAR, CAB, ISO, ARJ, LZH, CHM, Z, CPIO, RPM, DEB and NSIS
http://dev.nomad-net.info/articles/sevenzipinterface
7. NUnrar – Unrar in pure C#
NUnrar is a native C# unrar library that supports forward-only (i.e. Network) streams and Silverlight. No intermediate buffering necessary. Random access is also available. It was ported from the JUnrar version of unrar (http://java-unrar.sourceforge.net/) by Edmund Wagner.
https://archive.codeplex.com/?p=nunrar
8. SharpCompress – a fully native C# library for RAR, 7Zip, Zip, Tar, GZip, BZip2
SharpCompress is a compression library in pure C# for .NET Standard 1.3 and 2.0 that can unrar, un7zip, unzip, untar unbzip2 and ungzip with forward-only reading and file random access APIs. Write support for zip/tar/bzip2/gzip are implemented.
The major feature is support for non-seekable streams so large files can be processed on the fly (i.e. download stream).
https://github.com/adamhathcock/sharpcompress
Bookmarks for reading
there are code samples: https://stackoverflow.com/questions/3238173/how-to-extract-a-rar-file-in-c