TransporterSwift 工具库
Transporter 是一个方便上传和下载的库。
特性
-
支持并发或者顺序上传或者下载多个文件
-
支持后台上传和下载
-
支持进程跟踪 (单个任务或者任务组)
-
支持重置,停止,取消,重试任务
-
header 可配置
-
请求参数可配置
快速示例
let path = NSBundle.mainBundle().pathForResource("bigfile", ofType: "zip")let fileUrl = NSURL(fileURLWithPath: path!)!let task = UploadTask(url: "http://server.com", file: fileUrl) .progress { sent, total in let per = Double(sent) / Double(total) println("uploading: \(per)") } .completed { response, json, error in println("completed") } Transporter.add(task1 <--> task2 <--> task3) // concurrent tasks .progress { bytes, total in let per = Double(bytes) / Double(total) println("concurrent tasks: \(per)") } .completed { alltasks in println("task1, task2, task3: completed") } .add(task4 --> task5 --> task6) // serial tasks .progress { bytes, total in println("serial tasks") } .resume()
用法
// downloading tasklet task = DownloadTask(url: downloadUrl, destination: des) .progress { bytes, total in let per = Double(bytes) / Double(total) println("downloading: \(per)") } .completed { response, _, error in println("completed") }// uploading task// upload types: File, Data, Streamlet task = UploadTask(url: "http://server.com", data: uploadData) .progress { sent, total in let per = Double(sent) / Double(total) println("uploading: \(per)") } .completed { response, json, error in println("completed") }// tasktask.headers = ["key": "value"] task.params = ["key": "value"] task.pause() task.cancel() task.retry// background handling// add the following method in the app delegatefunc application(application: UIApplication, handleEventsForBackgroundURLSession identifier: String, completionHandler: () -> Void) { Transporter.handleEventsForBackgroundURLSection(identifier, completionHandler: completionHandler) }// Transporter configurationsTransporter.headers = [key: value] Transporter.timeoutIntervalForRequest = 30.0Transporter.timeoutIntervalForResource = 24 * 60 * 60.0Transporter.HTTPMaximumconnectionsPerHost = 5
评论
Dart-doc_coverageDart 库工具
Dart-doc_coverage 工具通过检查 Dart 库(或者包)来甄别公共 API 的评论。
Dart-doc_coverageDart 库工具
0
Underscore.jsJavaScript工具库
Underscore.js 是一个实用的JavaScript工具库,提供了类似 Prototype
Underscore.jsJavaScript工具库
0
Dart-doc_coverageDart 库工具
Dart-doc_coverage工具通过检查Dart库(或者包)来甄别公共API的评论。Dart-doc_coverage检查过后的每个评论都会在dartdocs.org上显示(例如路径文档)。
Dart-doc_coverageDart 库工具
0
Underscore.goGO 工具库
Underscore.go是一个非常有帮助的Go实用程序集。类似underscore.js,但是是GO的工具库。计划功能:godoccontainsindexOfworkerpoolsparallel
Underscore.goGO 工具库
0
utils4sscala 工具库
utils4s包含各种scala通用、好玩的工具库demo和使用文档,通过简单的代码演示和操作文档,各种库信手拈来。时间操作的示例代码:package cn.thinkjoy.utils4s.lamm
utils4sscala 工具库
0