net / com.drake.net / kotlinx.coroutines.CoroutineScope / Download
Download¶
fun CoroutineScope.Download(path:
String
, dir:
String
= NetConfig.app.externalCacheDir!!.absolutePath, tag:
Any
? = null, absolutePath:
Boolean
= false, method: RequestMethod = RequestMethod.GET, uid:
Any
? = coroutineContext[CoroutineExceptionHandler], block: Api.() ->
Unit
= {}): Deferred<
String
>
用于提交URL体下载文件(默认GET请求)
Parameters¶
path
- 请求路径, 非绝对路径会加上HOSTNetConfig.host为前缀
method
- 请求方式, 默认GET
dir
- 下载文件存放目录 {默认存在android/data/packageName/cache目录}
tag
- 可以传递对象给Request请求, 一般用于在拦截器/转换器中进行针对某个接口行为判断
absolutePath
- 下载链接是否是绝对路径
block
- 请求参数