init(path:pool:reportHead:reportProgress:)
Initializes a new file download delegate.
init(path: String, pool: NIOThreadPool? = nil, reportHead: ((HTTPClient.Task<Response>, HTTPResponseHead) -> Void)? = nil, reportProgress: ((HTTPClient.Task<Response>, Progress) -> Void)? = nil) throws
Parameters
- path
Path to a file you’d like to write the download to.
- pool
A thread pool to use for asynchronous file I/O. If nil, a shared thread pool will be used. Defaults to nil.
- 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
.