isWritable

Checks if the file located by this path exists and is writable.

inline fun Path.isWritable(): Boolean(source)
import java.nio.file.Path
import kotlin.io.path.isWritable

fun main() {
    val path = Path.of("example.txt")

    if (path.isWritable()) {
        println("$path is writable")
    } else {
        println("$path is not writable")
    }
}

Source