Skip to content

Instantly share code, notes, and snippets.

@jmfayard

jmfayard/okio.kt Secret

Created July 13, 2021 19:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmfayard/c9e9b2d7b71e5820825022fdb0582996 to your computer and use it in GitHub Desktop.
Save jmfayard/c9e9b2d7b71e5820825022fdb0582996 to your computer and use it in GitHub Desktop.
// commonMain
expect val fileSystem: FileSystem
fun fileIsReadable(filePath: String): Boolean =
fileSystem.exists(filePath.toPath())
fun readAllText(filePath: String): String =
fileSystem.read(filePath.toPath()) {
readUtf8()
}
fun writeAllText(filePath: String, text: String): Unit =
fileSystem.write(filePath.toPath()) {
writeUtf8(text)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment