Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to resume 7zip compression?

My application regularly upload large files. Regardless of their size, all files are compressed before uploaded to server.

Part of this project requirements is to resume nicely after crash/power failure, so right now compression is done this way:

  • large-file.bin sliced in N slices
  • Compress each slice & upload it

In case of crash, I pickup from the last slice.

To optimize upload speed, I'm currently looking into sending the whole file (uploads are resumed if failed) instead of sending slices one by one, so I'm looking into compressing the whole file instead of compressing each slice.

I'm currently using 7z.dll. I wonder if it's possible, in case of power failure, to tell 7z to resume compression.

I know I could always implement my own compression routine and implement such feature, but before going that road I wonder if it's possible to do that in 7z (which already have an excellent compression ratio)

like image 580
TheDude Avatar asked Mar 08 '12 20:03

TheDude


People also ask

Is 7-Zip better than WinRAR?

While both are compression programs, 7-Zip can compress files into a wider range of format types, including 7z. WinRAR can only compress into RAR or ZIP formats. However, both can decompress a wide variety of format types. Also, 7-Zip is open source and free, while WinRAR costs over $30 for a lifetime license.

Is .7z or .zip better compression?

zip and . 7z are lossless compression formats. .7z is newer and is likely to give you a better compression ratio, but it's not as widely supported as . zip, and I think it's somewhat more computationally expensive to compress/decompress.

How good is 7-Zip compression?

7-Zip is a file archive with the highest compression ratio. It works on the 7z format, which is the successor to the zip format. This format enables it to achieve more than a 1350 percent compression ratio compared to the zip format.


1 Answers

As far as I know, no compression algorithm supports that. You will likely have to recompress the source file from the beginning every time, discarding any output bytes until you reach the desired resume position, and then you can send the remaining output bytes from that point on.

like image 198
Remy Lebeau Avatar answered Oct 27 '22 11:10

Remy Lebeau