PrivMX DOCS
Version 2.2/Stores

Downloading Files

Tabs, Tab} from "fumadocs-ui/components/tabs"

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);

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.

This is documentation for PrivMX v2.2, which is no longer actively maintained.

For up-to-date documentation, go to latest here