Downloading Files
Info
The sample code on this page is based on the same assumptions mentioned in Managing Stores.
The code example below shows how to download a file from a Store in PrivMX:
// read large file chunk-by-chunk
auto bFileInfo {storesApi.getFile(binaryFileId)};
auto bHandle {storesApi.openFile(binaryFileId)};
size_t read = 0;
while (read < bFileInfo.size) {
auto data {storesApi.readFromFile(bHandle, 1024)};
read += data.size();
std::cout << "Read (from store) " << read << " out of: " << bFileInfo.size << std::endl;
}
storesApi.closeFile(bHandle);