Pure Lua 5.4 port of FileFS.
Uses the same on-disk format as the other host ports:
- 512-byte blocks
- magic number
78 11 45 14 - copy-on-write journal stored beside the image as
<image>-j
No third-party Lua rocks are required — only the standard library (io / os).
cd lua
lua5.4 tests/run_tests.lua
# or, if `lua` points at 5.4+:
lua tests/run_tests.lualocal filefs = require("filefs")
local FileSystem = filefs.FileSystem
FileSystem.mkfs("demo.ffs")
local fsys = FileSystem.new()
fsys:mount("demo.ffs")
fsys:mkdir("docs")
fsys:chdir("docs")
local file = fsys:open("note.txt", "w")
fsys:write(file, FileSystem.bytes_from_string("hello"))
fsys:close(file)Set package.path so it can see this directory (the test runner does this for you):
package.path = "./?.lua;./?/init.lua;" .. package.pathFileSystem/mkfs/newFileType/SeekWhence/FileFsErrorFileSystem.bytes_from_string/FileSystem.string_from_byteshelpers
- Tree mutations happen in memory; persistence rewrites the image via the journal (same approach as the Kotlin / MoonBit ports).
- File I/O buffers are Lua arrays of byte values (
0–255).