STDownloader
A light weight data download libiary.
Example
To run the example project, clone the repo, and run pod install
from the Example directory first.
Installation
STDownloader is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'STDownloader'
Sample Code
NSString *downloadUrlString = @"https://dldir1.qq.com/qqfile/qq/TIM2.1.5/23141/TIM2.1.5.exe" ;
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:downloadUrlString]] ;
NSUUID *receiptID = [NSUUID UUID] ;
STDownloadSuccess success = ^(NSURLRequest *request,NSString *downloadFilePath) {
NSLog(@"Download Success:%@",downloadFilePath) ;
} ;
STDownloadProgress progress = ^(NSURLRequest *request,NSUInteger receiveDataLength,NSUInteger totalDataLength,NSData *receiveData) {
NSLog(@"Download Progress:%.2f",receiveDataLength * 1.0f / totalDataLength) ;
};
STDownloadFailure failure = ^(NSURLRequest *request,NSError *error) {
NSLog(@"Download Failure:%@",error) ;
} ;
[[STDownloader defaultInstance] downloadFileForURLRequest:request receiptID:receiptID success:success progress:progress failure:failure] ;
Author
czqasn,[email protected]
License
STDownloader is available under the MIT license. See the LICENSE file for more info.