Licensee was looking for a way to get total file size to display download progress. On Windows (which uses the curl library for Http request/response), binding a function to the OnRequestProgress delegate and getting the FHttpResponsePtr from the FHttpRequestPtr and calling FHttpResponsePtr::GetContentLength() correctly returns the total file size.
Output from sample project
LogHttpTest:Warning: Received Size = 16384, TotalSize = 1291706, PercentDone = 1.27 LogHttpTest:Warning: Received Size = 32768, TotalSize = 1291706, PercentDone = 2.54 LogHttpTest:Warning: Received Size = 49152, TotalSize = 1291706, PercentDone = 3.81
On Mac total size returns the same value as received size, so it's not possible to calculate a percent done. (I only tested Mac, but if memory serves, the implementation is the same for Mac and iOS):
LogHttpTest:warning: Received Size = 81301, TotalSize = 81301, PercentDone = 100.00100.00 LogHttpTest:warning: Received Size = 325157, TotalSize = 325157, PercentDone = 100.00100.00 LogHttpTest:warning: Received Size = 589205, TotalSize = 589205, PercentDone = 100.00100.00 LogHttpTest:warning: Received Size = 801741, TotalSize = 801741, PercentDone = 100.00100.00 LogHttpTest:warning: Received Size = 1278325, TotalSize = 1278325, PercentDone = 100.00100.00
Originally reported here:
FHttpRequestPtrで、ダウンロードしているファイルのTotalSizeが知りたいです。
Why does the REMOVE method of map container remove elements have memory leaks?
How does TextureRenderTarget2D get TArray<uint8> type data?
How to delete some elements correctly when deleting an array loop?
UMG RichText not appear image when packaged
What is the cause of the packaging error falling back to 'GameUserSettings' in ue5?
How to convert the datasmith scene file to BluePrint. Create animations in BluePrint.
Head over to the existing Questions & Answers thread and let us know what's up.