whitecatboard / Lua-RTOS-ESP32

Lua RTOS for ESP32
Other
1.18k stars 221 forks source link

query file system usage #301

Closed the0ne closed 4 years ago

the0ne commented 4 years ago

added support to query the current fs usage:

/ > os.df()
/ > df
/ > fs.usage()
/ > os.df("/")
/ > os.df("/rfs")
/ > os.df("/sd")

First value returned is free space, second value is total space, e.g. for a spiffs root, 128mb fat-formatted sd-card with 12mb used, 4k ramfs:

/examples/lua > os.df("/")
358679        482673
/examples/lua > os.df("/sd")
238791168        251984384
/examples/lua > os.df("/rfs")
4096        4096
/examples/lua >

also linked os.format to the fs module, which might look more logical:

/ > fs.format()
/ > fs.format("/sd")