rikyoz / bit7z

A C++ static library offering a clean and simple interface to the 7-zip shared libraries.
https://rikyoz.github.io/bit7z
Mozilla Public License 2.0
623 stars 113 forks source link

[Feature Request]: Copy compressed data between archives without recompression #87

Closed RScherzer closed 2 years ago

RScherzer commented 2 years ago

Feature description

Hi,

is there already a functionality which allows copying compressed data without the need of decompression from one archive to another. Of course I'd expect this only for identical filetypes and non solid archives. So for example from .zip to .zip it is possible (e.g. ZipArchive Library is able to do this). So it would basically be a copy of the compressed data block and updating the structures (central/local file headers). Or is this planned for the future. It would be great since it would reduce the dependency from other libraries ;-)

Additional context

No response

Code of Conduct

rikyoz commented 2 years ago

Hi!

is there already a functionality which allows copying compressed data without the need of decompression from one archive to another

Unfortunately, no.

Of course I'd expect this only for identical filetypes and non solid archives. So for example from .zip to .zip it is possible (e.g. ZipArchive Library is able to do this). So it would basically be a copy of the compressed data block and updating the structures (central/local file headers). Or is this planned for the future. It would be great since it would reduce the dependency from other libraries ;-)

The main problem is that bit7z uses the 7-zip API, and this latter doesn't support this kind of operation, afaik. 7-zip allows passing only an uncompressed stream of data so that it can then compress it.

So I don't think it will be possible to implement this feature, even in the future.

I don't know how the ZipArchive library works, but it can probably achieve this by implementing the zip compression from scratch, hence having full control of the streams of data.

As a side note, the next version of bit7z will provide functionalities for editing existing archives, e.g., renaming/deleting/updating files; updating files works with an uncompressed stream, obviously. I don't know if it can fit in your use case, though.