How to find file size 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:
import java.io.File
val someFile = new File("somefile.txt")
val fileSize = someFile.length
If you want something Scala-specific, you can use an external framework like scalax.io or rapture.io
java.nio.file.Files.size
from api:
public static long size(Path path) throws IOException
Returns the size of a file (in bytes)