Version: v0.8.1 - Beta.  We welcome contributors & feedback.

File.countLines

$file.countLines($options={}) -> number

Description

Returns the number of lines in the file.

By default, it will skip over lines that are empty or have only whitespace characters.

If the file does not exist, an error will be thrown.

$dataFile = file'files:/data.txt'

$numLines = $dataFile.countLines()
//= Ex: 33

Options

Option Value Description
keepBlanks true/false Do not skip blank lines.
file'files:/data.txt'.countLines(-keepBlanks)

See Also