Create a sink which will write incoming ByteString s to a given file.

File IO Sinks and Sources


The toFile operator has been deprecated, use toPath instead.




Creates a Sink which writes incoming ByteString elements to the given file path. Overwrites existing files by truncating their contents as default. Materializes a Future CompletionStage 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.

Found an error in this documentation? The source code for this page can be found here. Please feel free to edit and contribute a pull request.