# asFile

abstract fun asFile(charset: String): File(source)

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.

#### Return

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

#### Since

2.2

#### Parameters

charset

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

abstract fun asFile(): File(source)

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

#### Since

2.2