1 Star 0 Fork 379

长风 / LuatOS

forked from 合宙Luat / LuatOS 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
luat_lib_fs.md 1000 Bytes
一键复制 编辑 原始数据 按行查看 历史
三个字儿 提交于 2020-08-18 18:29 . 更新文档
module
luat_lib_fs

fs.fsstat

fs.fsstat(path)

获取文件系统信息

参数表

Name Type Description
path string 路径,默认"/",可选

返回值

No. Type Description
1 boolean 获取成功返回true,否则返回false
2 int 总的block数量
3 int 已使用的block数量
4 int block的大小,单位字节
5 string 文件系统类型,例如lfs代表littlefs

调用示例

-- 打印根分区的信息
log.info("fsstat", fs.fsstat("/"))

fs.fsize

fs.fsize(path)

获取文件大小

参数表

Name Type Description
path string 文件路径

返回值

int: 文件大小,若获取失败会返回0

调用示例

-- 打印main.luac的大小
log.info("fsize", fs.fsize("/main.luac"))
Lua
1
https://gitee.com/LCF228/LuatOS.git
git@gitee.com:LCF228/LuatOS.git
LCF228
LuatOS
LuatOS
master

搜索帮助