- 授权协议: MIT
- 开发语言: Swift
- 操作系统: OS X
- 软件首页: https://github.com/nghialv/Transporter
- 官方下载: https://github.com/nghialv/Transporter
软件介绍
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
高效程序员的45个习惯
Venkat Subramaniam、Andy Hunt / 钱安川、郑柯 / 人民邮电出版社 / 2010-01 / 35.00元
“书中‘切身感受’的内容非常有价值——通过它我们可以做到学有所思,思有所悟,悟有所行。” ——Nathaniel T. Schutta,《Ajax基础教程》作者 “此书通过常理和经验,阐述了为什么你应该在项目中使用敏捷方法。最难得的是,这些行之有效的实战经验,竟然从一本书中得到了。” ——Matthew Johnson,软件工程师 十年来,软件行业发生了翻天覆地的变化。敏捷......一起来看看 《高效程序员的45个习惯》 这本书的介绍吧!
