writeToFile

suspend fun ByteStream.writeToFile(file: File): Long

Write the contents of this ByteStream to file and close it

Return

the number of bytes written


suspend fun ByteStream.writeToFile(path: Path): Long

Write the contents of this ByteStream to file at the given path

Return

the number of bytes written