DownloadOperation

class DownloadOperation : DefaultOperation

The operation responsible for downloading the file.

Initiates with URLSessionTaskType as downloadType. It has two options for downloading a file, via URLSessionDownloadTask or URLSessionDataTask. If downloadType is equal to downloadTask, then downloading will be implemented through URLSessionDownloadTask, otherwise through URLSessionDataTask. In terms of performance, both options work the same way. At the moment there is not much difference, however, when downloading via URLSessionDownloadTask, if the response does not contain the Content-Length header, then the file size in progress will be empty, while URLSessionDataTask always has the file size. If you need progress according to the file size and response header doesn’t contain Content-Length, then use URLSessionDataTask, otherwise, try to always use URLSessionDownloadTask. In the future, more features will probably be added for each type of download. For example, support for resuming download or the ability to download in the background.