writeText

fun writeText(path: Path, contents: String)(source)

Strict UTF-8, atomically replacing the entire file. Invalid surrogates never publish.