Descargar por fragmento
Es posible descargar continuamente datos binarios usando HTTP por fragmentos, recibiendo los datos binarios como un flujo. Especifica el tamaño del fragmento para cada descarga y recibe un callback OnComplete para cada fragmento descargado.
- 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));
}));