Tải xuống theo từng khối
Có thể tải xuống dữ liệu nhị phân liên tục qua HTTP theo từng khối, nhận dữ liệu nhị phân dưới dạng luồng. Chỉ định kích thước khối cho mỗi lần tải xuống và nhận callback OnComplete cho mỗi khối đã tải xuống.
- 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));
}));