# Function: downloadFile
▸ downloadFile(params
: DownloadFileParams): Promise‹DownloadFileRes› & DownloadTask
下载文件资源到本地。客户端直接发起一个 HTTPS GET 请求,返回文件的本地临时路径 (本地路径),单次下载允许的最大文件为 200MB。使用前请注意阅读相关说明。 注意:请在服务端响应的 header 中指定合理的 Content-Type 字段,以保证客户端正确处理文件类型。
# 参数:
属性 | 类型 |
---|---|
params | DownloadFileParams |
DownloadFileParams
属性 | 类型 | 描述 |
---|---|---|
filePath? | string | 指定文件下载后存储的路径 (本地路径) |
header? | Record‹string, string | string[]› | HTTP 请求的 Header,Header 中不能设置 Referer |
timeout? | number | 超时时间,单位为毫秒 |
url | string | 下载资源的 url |
complete? | Method | 接口调用结束的回调函数(调用成功、失败都会执行) |
fail? | Method | 接口调用失败的回调函数 |
success? | Method | 接口调用成功的回调函数 |
# 返回值:
Promise‹DownloadFileRes› & DownloadTask