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

I want to compress the file in a path to my 7z compressed file, is it supported? #66

Closed LARVM closed 2 years ago

LARVM commented 2 years ago

I want to compress the file in a path to my 7z compressed file, is it supported?

rikyoz commented 2 years ago

Hi! You can compress a file to an existing archive by enabling the update mode in BitCompressor. E.g.:

Bit7zLibrary lib{};
BitCompressor compressor{lib, BitFormat::SevenZip};
compressor.setUpdateMode(true);

//Adding "new_file.ext" to the existing archive
compressor.compressFile(L"path/to/new_file.ext", L"path/to/existing_archive.7z");
LARVM commented 2 years ago

Yes, Thanks!