from typing import Counter


def count_chars_in_file(input_filename: str, line_by_line: bool = True) -> Counter:
    """
    Iterates line-by-line through specified file and counts the characters present in
    each line. Returns resulting Counter. All letters (uppercase and lowercase) are
    counted as lowercase letters. The parameter line_by_line determines whether to read
    the file line-by-line (the default) or to read it all at once.
    """
    counter = Counter()

    with open(input_filename, encoding="utf8") as input_file:
        if line_by_line:
            for line in input_file:
                counter.update(line.lower())
        else:
            counter.update(input_file.read().lower())

    return counter