Skip to content

递归取得文件夹大小 ​

方法名 ​

getDirSize

用法 ​

用法示例 ​

js
module.getDirSize({
  dirPath: "/storage/emulated/0/qqmusic",
}, res => {
  console.log(res)
})

参数说明 ​

参数名参数类型是否必填默认值参数描述
dirPathString否无sd卡文件夹绝对路径

回调 ​

回调示例 ​

json
{
    "data": {
        "size": 102022309,
        "sizeFormat": "97.30M"
    },
    "message": "",
    "code": 0
}

回调说明 ​

参数名参数类型参数描述
messageString消息提示
dataObject数据对象
data.sizeInteger文件大小字节
data.sizeFormatString文件大小格式化数据
codeInteger返回类型,0.成功,其他:失败