getTotalSize是获取三方应用可用的手机总存储大小,获取指定路径文件大小可参考文档:https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-file-fs-V5\#fsstat示例参考:readFileSize(filesDir: string) { let filePath = filesDir + "/test.txt"; fs.stat(filePath).then((stat: fs.Stat) => { console.info("get file info succeed, the size of file is " + stat.size); }).catch((err: BusinessError) => { console.error("get file info failed with error message: " + err.message + ", error code: " + err.code); }); }
getTotalSize是获取三方应用可用的手机总存储大小,获取指定路径文件大小可参考文档:https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-file-fs-V5\#fsstat
示例参考: