Download per chunk
It is possible to continuously download binary data using HTTP per chunks, receiving the binary data as a stream. Specify the chunk size for each download, and receive an OnComplete callback for each downloaded chunk.
- Blueprint
- C++
UFileToMemoryDownloader::DownloadFileToMemoryPerChunk(TEXT("https://www.example.com/some_file.raw"), 15.0f, TEXT(""), 52428800,
FOnDownloadProgressNative::CreateLambda([](int64 BytesReceived, int64 ContentSize, float ProgressRatio)
{
UE_LOG(LogTemp, Log, TEXT("Download progress: %lld/%lld (%f)"), BytesReceived, ContentSize, ProgressRatio);
}), FOnFileToMemoryChunkDownloadCompleteNative::CreateLambda([](const TArray64<uint8>& DownloadedContent, UFileToMemoryDownloader* Downloader)
{
// Handle the downloaded chunk here
UE_LOG(LogTemp, Log, TEXT("Downloaded chunk size: %lld"), DownloadedContent.Num());
}), FOnFileToMemoryAllChunksDownloadCompleteNative::CreateLambda([](EDownloadToMemoryResult Result, UFileToMemoryDownloader* Downloader)
{
UE_LOG(LogTemp, Log, TEXT("Download result: %s"), *UEnum::GetValueAsString(Result));
}));