I am using downloadTask of URLSession to download a large file. The problem i am facing is how to provide pause and resume functionality. I have read that cancelling the downloadTask with resumeData gives back resumeData which can be used next time to resume the download. But for a really large file, this resumeData can be very large (i think. depending on file size and at what stage download is paused it can be very large). How do i persist this large resumeData so that i can use it next time to resume download. Also there can be multiple downloads at the same time, which increases the same problem more.
The resume data blob does not contain the actual received data. If it did, you wouldn't be able to resume downloading a multi-gigabyte file on a 32-bit architecture.
What it contains is a bunch of metadata for the transfer:
And it might just be the URL of a metadata file on disk that contains the things listed above. I'm not sure which.
Either way, you will not get a multi-gigabyte resumeData
blob. That would be devastating. The whole point of a download task is that it downloads to disk, not to memory.