Downloading Files
Downloading file content and accessing files.
Downloading a file from the Store and saving it by chunk to ByteArray:
val fileID = "FILE_ID"
val storeApi = connection.storeApi
var data = ByteArray(0)
val closedFileID = StoreFileStreamReader.openFile(
storeApi,
fileID,
).also {
do {
val chunk = it.read(StoreFileStream.OPTIMAL_SEND_SIZE)
data += chunk
} while (chunk.size.toLong() == StoreFileStream.OPTIMAL_SEND_SIZE)
}.close()