mc.getSavedFileInfo(Object object)

获取本地文件的文件信息。

Object object 参数

属性 类型 默认值 必填 说明
filePath String 文件路径 (本地路径)
success Function 接口调用成功的回调函数
fail Function 接口调用失败的回调函数
complete Function 接口调用结束的回调函数(调用成功、失败都会执行)

Object.success(Object res) 回调函数

属性 类型 说明
size Number 文件大小,单位 B
createTime Number 文件保存时的时间戳,从1970/01/01 08:00:00 到该时刻的秒数

示例代码:

getSavedFileInfo: function () {
    var _this = this;
    mc.getSavedFileList({
      success: function (res) {
        if (res.fileList.length > 0) {
          mc.getSavedFileInfo({
            filePath: res.fileList[0].filePath,
            complete: function(res){
              _this.setData({
                getSavedFileInfo: JSON.stringify(res, null, 2)
              })
            }
          })
        }
        else{
          _this.setData({
            saveFileInfo: '未保存文件'
          })
        }
      }
    })
  }

results matching ""

    No results matching ""

    results matching ""

      No results matching ""