This helper returns the size of a file in bytes. It returns false when the file cannot be opened.
1 | function io.filesize(path) |
Binary mode avoids platform-specific text newline translation. The function saves and restores the original cursor position, although that is mainly useful if adapted to accept an already-open handle.