title: Taro.getSavedFileList(option)

sidebar_label: getSavedFileList

获取本地已保存的文件列表

支持情况:getSavedFileList - 图1 getSavedFileList - 图2 getSavedFileList - 图3

参考文档

类型

  1. (option?: Option) => Promise<SuccessCallbackResult>

参数

参数 类型
option Option

Option

参数 类型 必填 说明
complete (res: TaroGeneral.CallbackResult) => void 接口调用结束的回调函数(调用成功、失败都会执行)
fail (res: TaroGeneral.CallbackResult) => void 接口调用失败的回调函数
success (result: SuccessCallbackResult) => void 接口调用成功的回调函数

SuccessCallbackResult

参数 类型 说明
fileList FileItem[] 文件数组
errMsg string 调用结果

FileItem

文件数组

参数 类型 说明
createTime number 文件保存时的时间戳,从1970/01/01 08:00:00 到当前时间的秒数
filePath string 本地路径
size number 本地文件大小,以字节为单位

示例代码

  1. Taro.getSavedFileList({
  2. success: function (res) {
  3. console.log(res.fileList)
  4. }
  5. })