Creates a Sink which writes incoming ByteString elements to the given file path. Overwrites existing files by truncating their contents as default. Materializes a FutureCompletionStage of IOResult that will be completed with the size of the file (in bytes) at the streams completion, and a possible exception if IO operation was not completed successfully.
sourceval file =Paths.get("greeting.txt")
val text =Source.single("Hello Akka Stream!")
val result:Future[IOResult]= text.map(t =>ByteString(t)).runWith(FileIO.toPath(file))