mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2025-12-30 00:53:50 +00:00
Create file_size.lua
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user