Skip to content

判断文件或文件夹是否存在 v1.9.0 ​

方法名 ​

fileExists

用法 ​

用法示例 ​

js
module.fileExists({
  //文件或文件夹夹路径
  path: "/storage/emulated/0/leven_files/1.txt"
}, res => {
  this.writeLog(JSON.stringify(res))
});

参数说明 ​

参数名参数类型是否必填默认值参数描述
pathString是无文件或文件夹夹路径

回调 ​

回调示例 ​

json
{
  "data": {
    "isExists": true
  },
  "message": "",
  "code": 0
}

回调说明 ​

参数名参数类型参数描述
messageString消息提示
dataObject数据对象
data.isExistsBooleantrue:文件存在,false:文件不存在
codeInteger返回类型,0.成功,其他:失败