File.stream vs File.read

Hello everyone

I am creating a CLI that implements the same functions as de WC CLI for unix system. I was able to achieve the expected result using File.read! but it loads everything into memory so I decided to use stream to solve the problem but somehow the results is different. Does anyone know what I missing here? Thanks