Akka Streaming File IO
Akka Streams provide simple Sources and Sinks that can work with ByteString instances to perform IO operations on files. Streaming data from a file is as easy as creating a FileIO.fromPath given a target path, and an optional chunkSize which determines the buffer size determined as one "element" in such stream: import akka . stream . scaladsl . _ val file = Paths . get ( "example.csv" ) val foreach : Future [ IOResult ] = FileIO . fromPath ( file ) . to ( Sink . ignore ) . run () Please note that these processing stages are backed by Actors and by default are configured to run on a pre-configured threadpool-backed dispatcher dedicated for File IO. This is very important as it isolates the blocking file IO operations from the rest of the ActorSystem allowing each dispatcher to be utilised in the most efficient way. If you want to configure a custom dispatcher for file IO operations globally, you can do so by changin...