Create file_size.lua

This commit is contained in:
FusionPBX
2025-07-08 16:38:28 -06:00
committed by GitHub
parent 0012ec34f7
commit ec6e30c037

View File

@@ -0,0 +1,19 @@
--get the file size
function file_size(file_path)
-- Open the file for reading
local file = io.open(file_path, "r");
--return 0 if unable to open the file
if not file then
return 0;
end
-- Seek to the end of the file and get the position
local size = file:seek("end");
-- Close the file
file:close();
return size;
end