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]: How to us Multi-volume archives #62

Closed fengshaoxie closed 2 years ago

fengshaoxie commented 2 years ago

Feature description

can write an example to use Multi-volume archives

Additional context

No response

Code of Conduct

rikyoz commented 2 years ago

Hi!

Here are some examples:

Extraction

For all multi-volume archive types, except RAR ones:

BitExtractor extractor{lib, BitFormat::Split};
extractor.extract(L"archive.7z.001", L"out_dir/");

RAR and RAR5 archives use a different multi-volume scheme:

BitExtractor extractor{lib, BitFormat::Rar5};
extractor.extract(L"archive.part1.rar", L"out_dir/");
BitExtractor extractor{lib, BitFormat::Rar};
extractor.extract(L"archive.rar", L"out_dir/");

Creation

BitCompressor compressor{lib, BitFormat::SevenZip};
compressor.setVolumeSize(42 * 1024 * 1024); // size (in bytes) of the volumes; in this case, 42MB
compressor.compressDirectory(L"in_dir/", L"archive.7z");

Notes:

Hope to have helped!