here is the code snippet
/data/user_information.csv is packed inside of jar file which is in classpath. Everything is built with sbt. Is there a way to read user_information.csv with csv function from jar file which is in classpath.
val path = getClass.getResource("/data/user_information.csv").getFile
val file:File = new File(new java.io.File(path))
that snippet does not work
The csv built-in currently locates the file on the file system, not in the classpath (but that’s an interesting use case, we might consider implementing it), so basically, the answer is: currently no.
Anyway, csv(file) only produces a Array[Map[String, String]] that’s implicitly converted into a feeder, so you can just copy SeparatedValuesParser logic in your snippet:
Just use Source.fromInputStream instead of fromFile.