So this reads the entire file twice, once, to count the number of lines?

Personally I'd prefer progress based on the amount of bytes, as this can be done without a second pass.