number of lines of a file, without loading all the contents into memory

10 views
Skip to first unread message

David Portabella

unread,
Nov 24, 2017, 4:20:10 AM11/24/17
to ammonite-scala
this very compact code tells the number of lines of the file:
val p = root/'tmp/"file.txt read.lines(p).length

however I guess it loads all the content into memory.
is there a way to achieve the same result using ammonite without loading all the content into memory?

Reply all
Reply to author
Forward
0 new messages