init(path:reportHead:reportProgress:)

Initializes a new file download delegate and uses the shared thread pool of the HTTPClient for file I/O.

FileDownloadDelegate.swift:111
convenience init(path: String, reportHead: ((HTTPResponseHead) -> Void)? = nil, reportProgress: ((Progress) -> Void)? = nil) throws

Parameters

path

Path to a file you’d like to write the download to.

reportHead

A closure called when the response head is available.

reportProgress

A closure called when a body chunk has been downloaded, with the total byte count and download byte count passed to it as arguments. The callbacks will be invoked in the same threading context that the delegate itself is invoked, as controlled by EventLoopPreference.