init(path:pool:reportHead:reportProgress:)

    Initializes a new file download delegate.

    FileDownloadDelegate.swift:80
    convenience init(path: String, pool: NIOThreadPool, reportHead: ((HTTPResponseHead) -> Void)? = nil, reportProgress: ((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.

    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.

    Other members in extension

    Types

    • 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.

    Typealiases

    Type members

    Instance members