简体   繁体   中英

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)

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM