For testing purposes, I’m adding the ability to read
*.json
files into kotlin strings. My project targets JVM, JS, and iOS.
My approach was to create a common:
expect fun readFileToString(file: String) : String?
And then implement actuals in each target.
I have iOS and JVM working, but am not sure of the best way to implement the
actual
in JS.
Here’s my JVM `actual`:
import java.io.File
actual fun readFileToString(file: String) : String? {
return File(file).readText(Charsets.UTF_8)
}
Anyone done something like this?
I assume I’ll use
fs.fileReadSync:
but I’m not sure what I need to import to access that method?