• Reads a file line by line and calls the given function for each line. The lineNumber starts at 0. The maxLines option limits the maximum number of read lines and is Infinity by default.

    Parameters

    • filePath: string
    • onLine: (line: Buffer, lineNumber: number) => void
    • maxLines: number = Infinity

    Returns boolean

    Whether the file exists and all lines have been successfully read (false if maxLines was reached)

    See readLineByLine for an asynchronous version.