diff --git a/app/switch/resources/scripts/resources/functions/file_size.lua b/app/switch/resources/scripts/resources/functions/file_size.lua new file mode 100644 index 0000000000..68d97775dd --- /dev/null +++ b/app/switch/resources/scripts/resources/functions/file_size.lua @@ -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