I have a text file that I want to compress after it gets an specified size. I've already seen GZipStream
which works great, but RAR compression is much better.
I've been looking for a library that can compress a file with RAR (I really don't care about extracting or uncompressing), but I couldn't find one yet.
Compress a file with RAR
Asked Answered
I recall RAR having good compression but being very slow compared to some others. 7z I think both has better compression and is faster than RAR, and I believe they have a C# wrapper... dev.nomad-net.info/articles/sevenzipinterface –
Erode
7z's API doesn't actually compress to any commonly used file format. It's a file format specific to the 7z API (LZMA) –
Tree
@EricJ. Not so, that's just a common urban legend. WinRAR is significantly more efficient, and often both faster and smaller (ignoring the features like split checking and recovery). Details: maximumcompression.com/index.html –
Streptokinase
I think there's none like WinRAR, but as far as I can see... I'll have to use 7z because WinRAR it's not free –
Goines
As the RAR compression algorithm isn't free (only the decompression algorithm is), you won't find a library for it (or have to purchase a license).
A good alternative is the LZMA SDK that delivers the compression algorithms used in 7-Zip.
For a compression ratio/speed comparison, you can have a look e.g. at the Maximum Compression summary page, ranks 50 and 52, comparing WinRAR 4.01 in "Best Solid" mode and 7-Zip 9.22 in "Ultra" mode. WinRAR compresses only slightly better (<1%) and faster, 7-Zip decompresses faster.
Note that, as peachykeen noted, if you look at the efficiency ratings instead of size, WinRAR in normal mode is much faster than 7-Zip.
In the efficiency ratings, WinRAR (on normal, normal solid, or best) has a reliable edge over 7z. This applies doubly to executables, images and audio, which WinRAR has specialized algos for. maximumcompression.com/data/summary_mf2.php –
Streptokinase
@peachykeen: Edited the answer. However, I hope you undo your downvote, because the original question was about a RAR compression library which isn't available (for free) and the focus was on file size. –
Seaplane
@schnaader: Thanks for the advice, I didn't know WinRAR isn't free and the 7-Zip is a good alternative. I'm trying to work with the SharpCompress library because I found it a little bit easier to use than the one you suggested me. However I can't find good and clear examples of how to use both. I'll let you know my progress during the day, thanks! –
Goines
© 2022 - 2024 — McMap. All rights reserved.