简体   繁体   中英

suspend and resume alamofire download request - large file

I'm using Alamofire to download large files in my ios project. When i cancel a download request (that is currently downloading a large file to disk) - this request produces resumeData with the data downloaded so far - but I would like a responseURL with the URL of the file with the partially downloaded data. I plan to use the responseURL serializer at the end to never load the entire data in memory - but if I want to suspend and resume downloads - then this is forcing me to load the data in memory.

there's a fileURL in the download request - but the documentation states that this is populated after the download has finished.

any pointers/suggestions would be appreciated?

As explained on GitHub , resumeData only includes the data necessary to resume a download, not the actual download data itself, so it's perfectly safe to keep it around in memory. You can parse the value to get the URL of the partially downloaded data, but it's not a formatted encoding, so it's not really appropriate for Alamofire to parse it directly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM