Count Lines (LCC.web_file.line_count)
Signature
count, err = LCC.web_file.line_count(path, timeout?)
Parameters
- path
String. File whose lines should be counted. - timeout
Number, optional. Request timeout in seconds, default60.
Returns
- count
Number. Total lines;nilon failure. - err
String ornil. Error description when the call fails.
Notes
Returns the line count directly, faster than fetching the entire file.
Works well for large files.
Example
local count, err = LCC.web_file.line_count("/logs/task.log")
if count then
print("Log lines:" .. count)
end