didReceiveHead(task:_:)
FileDownloadDelegate.swift:132func didReceiveHead(task: HTTPClient.Task<Response>, _ head: HTTPResponseHead) -> EventLoopFuture<Void>
func didReceiveHead(task: HTTPClient.Task<Response>, _ head: HTTPResponseHead) -> EventLoopFuture<Void>
s15AsyncHTTPClient20FileDownloadDelegateC14didReceiveHead4task_7NIOCore15EventLoopFutureCyytGAA0B0C4TaskCy_AC8ProgressVG_8NIOHTTP1012HTTPResponseH0VtF
What are these?1F6V5
import AsyncHTTPClient
This package provides simple HTTP Client library built on top of SwiftNIO.
final class FileDownloadDelegate
Handles a streaming download to a given file path, allowing headers and progress to be reported.
class HTTPClient
HTTPClient class provides API for request execution.
final class Task<Response>
Response execution context.
typealias Response = Progress
struct HTTPResponseHead
A representation of the status line and header fields of a HTTP response.
final class EventLoopFuture<Value>
Holder for a result that will be provided later.
typealias Void = ()
The return type of functions that don’t explicitly specify a return type, that is, an empty tuple ()
.
init(path: String, pool: NIOThreadPool? = nil, reportHead: ((HTTPClient.Task<Response>, HTTPResponseHead) -> Void)? = nil, reportProgress: ((HTTPClient.Task<Response>, Progress) -> Void)? = nil) throws
Initializes a new file download delegate.
convenience init(path: String, pool: NIOThreadPool, reportHead: ((HTTPResponseHead) -> Void)? = nil, reportProgress: ((Progress) -> Void)? = nil) throws
Initializes a new file download delegate.
convenience init(path: String, reportHead: ((HTTPResponseHead) -> Void)? = nil, reportProgress: ((Progress) -> Void)? = nil) throws
Initializes a new file download delegate and uses the shared thread pool of the HTTPClient
for file I/O.
func didFinishRequest(task: HTTPClient.Task<Response>) throws -> Response
func didReceiveBodyPart(task: HTTPClient.Task<Response>, _ buffer: ByteBuffer) -> EventLoopFuture<Void>
func didReceiveError(task: HTTPClient.Task<Progress>, _ error: Error)
struct Progress
The response type for this delegate: the total count of bytes as reported by the response “Content-Length” header (if available) and the count of bytes downloaded.