PrivMX DOCS
Version 2.6/Stores

Downloading Files

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 {storeApi.getFile(binaryFileId)};
auto bHandle {storeApi.openFile(binaryFileId)};
size_t read = 0;
while (read < bFileInfo.size) {
	auto data {storeApi.readFromFile(bHandle, 1024)};
	read += data.size();
	std::cout << "Read (from store) " << read << " out of: " << bFileInfo.size << std::endl;
}
storeApi.closeFile(bHandle);

We use cookies on our website. We use them to ensure the proper functioning of the site and, if you agree, for purposes we set, such as analytics or marketing.