fileWrite

fun fileWrite(path: String, contents: String)

Writes a string as the contents of a file (overwriting if the path already exists).

Example (REPL) usage (using linesToString):

>>> fileWrite("test-does-not-exist.txt", linesToString("howdy", "Khoury"))
>>> fileReadAsList("test-does-not-exist.txt")
res5: kotlin.collections.List<kotlin.String> = [howdy, Khoury]
>>> fileReadAsString("test-does-not-exist.txt")
res6: kotlin.String = howdy
Khoury

And now (in the same directory) is a file named test-does-not-exist.txt with two lines and the following contents:

howdy
Khoury

Parameters

path

path relative or absolute path to a file

contents

what to write as the contents of the file