I am looking for a lossless archive/compression library that supports random-access extraction of particular files, and would also like to perform such extraction in C++, meaning from C++ executable:
- Load the entire archive to memory
- Perform extraction for particular files from the archive in memory to a buffer in memory.
The purpose is to reduce the number of times I have to read data from the drive, and also the amount of data transferred from the drive.
I know that such algorithms exist - for example, windows "zip" and some tar compression schemes are able to do this. However, what I need is to perform these operations from a C++ executable, and step 1 above is important so as to reduce the number of times I have to read/transfer data from the drive - so performing command line operations within C++ is not a sufficient solution.
Example:
- I have 3 archived files, and and I know I have to read 7 files located among 2 of the archives.
- I read archives 1 & 2 into memory (the ones I know that contain the 7 files).
- I selectively extract 3 files from archive 1 (I know that they are in this archive).
- I selectively extract 4 files from archive 2 (I know that they are in this archive).
- Done.
Explanation: In this example I managed to reduce the amount of times I have to read from the drive from 7 to 2 times. If I used os/cmd operations, I would have read directly from the drive and this would be like reading 7 times. So such a solution is not sufficient. My use case requires me to reduce the number of times I go to the drive to read data.
Any suggestions? Thanks.