Read a file line by line and print line numbers

Yeah, in general iterating efficiently over some resource while also handling safe disposal, errors, being memory-efficient, etc., is pretty difficult. You may want to take a look at [ANN] First release of streaming

2 Likes