api / org.gradle.api.resources / TextResource / asFile

asFile

abstract fun asFile(charset: String): File

Returns a file containing the resource's text and using the given character encoding. If this resource is backed by a file with a matching encoding, that file may be returned. Otherwise, a temporary file will be created and returned.

Parameters

charset - a character encoding (e.g. "utf-8")

Return
a file containing the resource's text and using the given character encoding

abstract fun asFile(): File

Same as asFile(Charset.defaultCharset().name()).