MiniX自绘渲染跨平台框架
  • 框架说明
  • 声明式开发范式
  • 内置Api
指南
接口
  • Minix CLI
示例
  • 类Web框架

    • 框架说明
    • 类Web开发范式
    • 内置Api
  • 指南
  • 组件
  • 接口
  • 示例
  • 规范
  • DophinHybrid

    • 快速上手 (opens new window)
    • UI 组件库 (opens new window)
    • jsBridge 接口 (opens new window)
  • DolphinWeex

    • 快速上手 (opens new window)
    • UI 组件库 (opens new window)
    • jsBridge 接口 (opens new window)
  • 发布消息
  • 常见问题
  • 更新日志
  • 框架说明
  • 声明式开发范式
  • 内置Api
指南
接口
  • Minix CLI
示例
  • 类Web框架

    • 框架说明
    • 类Web开发范式
    • 内置Api
  • 指南
  • 组件
  • 接口
  • 示例
  • 规范
  • DophinHybrid

    • 快速上手 (opens new window)
    • UI 组件库 (opens new window)
    • jsBridge 接口 (opens new window)
  • DolphinWeex

    • 快速上手 (opens new window)
    • UI 组件库 (opens new window)
    • jsBridge 接口 (opens new window)
  • 发布消息
  • 常见问题
  • 更新日志
  • 快速上手
  • Basic 基础

  • Account

  • UI 界面

  • Device 设备

  • Bluetooth 蓝牙

  • Wifi WiFi

  • HomeManage 家庭管理

  • RoomManage 房间管理

  • Media 媒体

  • Location 定位

  • Encryption 加/解密

  • FileStorage 文件/存储

    • zip 压缩文件
    • unzip 解压文件
    • copyFile 复制文件
    • makeDir 新建文件夹
    • readFile 读取文件内容
    • renameFile 重命名文件
    • saveFile 保存文件到本地
    • appendFile 文件追加内容
    • deleteFile 删除文件 / 文件夹
    • isFileExist 判断当前文件是否存在
    • getFileList 获取当前weex应用已经保存的文件
    • getDownloadFileInfo 获取文件的下载信息,包括下载进度和状态。
    • startDownloadFile 开始文件下载
      • pauseDownloadFile 暂停文件下载
      • deleteDownloadFile 删除文件下载相关信息。
    • Http 网络/请求

    • weather 天气信息

    • Siri

    • TelPhone

    请扫码查看示例

    # startDownloadFile ^8.11

    开始文件下载

    # 请求参数

    Prop Type Required Default Comment
    downloadFolder String N downFiles 自定义下载目录,默认目录为 WeexApp/downFiles. downloadPath 为相对路径时,如为某个 sn8 对应的目录是 WeexApp/sn8. 支持绝对路径
    urls Array Y N/A 需要下载的文件的 url 数组,支持分片下载。如果数组长度大于 1,则下载完成后会合并为一个文件
    fileSuffix String N N/A 保存的文件后缀. 如果 urls 的长度大于 1 则是必要的,否则非必要

    # 引入接口模块

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

    # 接口调用示例

    const params = {
      downloadFolder: 'downFiles',
      urls: [
        'http://dolphin-weex-dev.msmartlife.cn/hybrid/docs/assets/img/1.daeeb425.png',
      ],
      fileSuffix: 'png',
    }
    bridge.startDownloadFile(
      params,
      (res) => {
        console.log('startDownloadFile-res', res)
      },
      (err) => {
        console.log('startDownloadFile-err', err)
      }
    )
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16

    # 返回参数

    • 成功时返回
    Prop Type Required Comment
    code Number Y 返回码 0-开始下载,其它:-1001-(缺少参数 fileSuffix,缺少参数 urls, 参数 urls 不能为空,下载失败,业务异常),-3007-手机空间不足,请清理空间再下载, -4009-存储未授权
    msg String N 返回信息
    status Number Y 当前下载状态。0-等待中, 1-下载中,2-下载成功,3-下载失败
    fileSize Number N 文件大小,单位是字节
    progress Number Y 当前下载状态进度(0-100)
    filePath String N 下载的所有文件的合并后的文件的绝对路径(非必须,当下载完成后返回)

    # 返回示例

    // 成功返回
    // 下载过程中,成功回调可能会多次触发,直到下载完成或者失败
    {
      code: 0,
      msg: "success",
      status: 2,
      progress: 100,
      filePath: "/storage/emulated/0/Android/data/com.midea.ai.appliances/files/WeexApp/downFiles/1.daeeb425.png",
      fileSize: 10972
    }
    
    // 失败返回
    {
      code: -1001,
      errorMsg: "缺少参数 urls"
    }
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16