downloadFile http 文件下载

downloadFile ^6.8

http 文件下载

#请求参数

Prop Type Value Comment
url String - 需要下载的文件网络地址
header Object - headHTTP 请求的 Header,Header 中不能设置 Refererer 配置
timeout Number - 超时时间,单位为毫秒

#引入接口模块

import bridge from '@minix-iot/etsbridge-sdk'

#参数代码示例

let params = {
  url: 'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=3105753044,45676271&fm=26&gp=0.jpg',
  header: {},
  timeout: 10000,
}

#接口调用示例

let params = { url: this.url, header: this.header, timeout: this.timeout }
bridge
  .downloadFile(params)
  .then((res) => {
    console.log(res)
  })
  .catch((err) => {
    console.log(err)
  })

#返回参数

  • 成功时返回
Prop Type Comment
code Number -
msg String -
relativeFilePath String 相对路径

#返回示例

{
    "code": 0,
    "msg": "success"
}
posted on 2024-12-28 16:36  AtlasLapetos  阅读(13)  评论(0)    收藏  举报