nst / STHTTPRequest

Obj-C / Cocoa HTTP requests for humans
BSD 3-Clause "New" or "Revised" License
825 stars 82 forks source link

Download Progress Block #8

Closed douglascayers closed 11 years ago

douglascayers commented 11 years ago

Hello,

Thanks for the easy-to-use API for http request, very handy! In our project we wanted to notify user % download complete for single large downloads. These changes add a new download progress block modeled after your existing upload progress block. If a developer provides a download progress block on the request then once connection begins receiving data the block will be invoked each time data is received, thus enabling the developer to update some status text or alert view to the user about download progress.

Example Usage:

STHTTPRequest *request = ...
request.downloadProgressBlock = ^(NSInteger bytesReceived, NSInteger totalBytesReceived, NSInteger totalBytesExpectedToReceive) {
    // notify user of download progress
}

Thanks!

nst commented 11 years ago

Cool feature with clean implementation. Thank you for contributing.

douglascayers commented 11 years ago

No problem! Thanks!