I'm writing a scala script, that need to know a size of a file. How do I do this correctly? In Python I would do
os.stat('somefile.txt').st_size
and in Scala?
I'm writing a scala script, that need to know a size of a file. How do I do this correctly? In Python I would do
os.stat('somefile.txt').st_size
and in Scala?
There is no way to do this using the Scala standard libraries. Without resorting to external libraries, you can use the Java File.length() method do do this. In Scala, this would look like:
If you want something Scala-specific, you can use an external framework like scalax.io or rapture.io