In the end, I used the library Korio. The documentation could be better, but all of the functionality I need is implemented for all platforms (Jvm, Desktop, Android, ..):

import com.soywiz.korio.file.std.*

suspend fun main {
  val cwd = localCurrentDirVfs
  val files = cwd.list()
  cwd["Hello.txt"].open().close()
  cwd["Hello.txt"].renameTo("Hi.txt")
  val metadata = cwd["Hi.txt"].stat()
}

On top of that, it allows usage of the same API for accessing online files, zip archives, etc. which is pretty neat.

Answer from Ford O. on Stack Overflow
🌐
Kotlin
kotlinlang.org › api › latest › jvm › stdlib › kotlin.io › java.io.-file
java.io.File - Kotlin Programming Language
April 14, 2023 - The Kotlin Standard Library provides ... with Kotlin. These include: Higher-order functions implementing idiomatic patterns (let, apply, use, synchronized, etc). Extension functions providing querying operations for collections (eager) and sequences (lazy). Various utilities for working with strings and char sequences. Extensions for JDK classes making it convenient to work with files, IO, and ...
🌐
GitHub
github.com › Kotlin › kotlinx-io
GitHub - Kotlin/kotlinx-io: Kotlin multiplatform I/O library · GitHub
kotlinx-io provides interfaces representing data sources and destinations - Source and Sink, and in addition to the mutable Buffer the library also provides an immutable sequence of bytes - ByteString.
Starred by 1.5K users
Forked by 80 users
Languages   Kotlin 99.9% | Java 0.1%
🌐
Kotlin
kotlinlang.org › api › core › kotlin-stdlib › kotlin.io
kotlin.io | Core API – Kotlin Programming Language
IO API for working with files and streams. TypesFunctionsProperties · Access · Denied · Exception · Link copied to clipboard · JVM · class AccessDeniedException(file: File, other: File? = null, reason: String? = null) : FileSystemException · An exception class which is used when we have not enough access for some operation. Since Kotlin 1.0 ·
🌐
Medium
medium.com › @sujitpanda › file-read-write-with-kotlin-io-31eff564dfe3
File Read/Write with Kotlin IO. In this post i will be explaining how… | by Sujit Panda | Medium
February 13, 2024 - private void copyDatabase(Context context, String dbName) { File dbPath = context.getDatabasePath(dbName); if (dbPath.exists()) { return; } dbPath.getParentFile().mkdirs(); try { final InputStream inputStream = context.getAssets().open("databases/" + dbName); final OutputStream output = new FileOutputStream(dbPath); byte[] buffer = new byte[8192]; int length; while ((length = inputStream.read(buffer, 0, 8192)) > 0) { output.write(buffer, 0, length); } output.flush(); output.close(); inputStream.close(); } catch (IOException e) { Log.d(TAG, "Failed to open file", e); e.printStackTrace(); } } This method will read the db file from assets and write it to the application database folder. This is the code I got after auto-conversion to Kotlin
🌐
Kotlin
kotlinlang.org › api › kotlinx-io › kotlinx-io-core › kotlinx.io.files
kotlinx.io.files | kotlinx-io – Kotlin Programming Language
Basic API for working with files. Until stated otherwise, types and functions provided by the library are not thread safe. #312 For wasmWasi target, directory listing (kotlinx.io.files.FileSystem.list) does not work with NodeJS runtime on Windows, as fd_readdir function is not implemented there.
🌐
Reddit
reddit.com › r/kotlin › kotlin/native: library for file io?
r/Kotlin on Reddit: Kotlin/native: library for file io?
January 14, 2022 -

By default, Kotlin/native does not come with file based IO similar to java.io or java.nio, but allows C functions from the platform.posix.* package. Is there some open source library available for provide similar API like java.nio which internally uses, but hides the use of platform.posix from teh library user? Is Jetbrains planning to do something like that?

🌐
Kotlin
kotlinlang.org › docs › tutorials › kotlin-for-py › file-io.html
File I/O - Kotlin Programming Language
Kotlin has inherited Java's fidgety (but very flexible) way of doing I/O, but with some simplifying extra features. We won't get into all of it here, so for starters, this is how to iterate through all the lines of a file (you'll need import java.io.File):
Find elsewhere
🌐
OneUptime
oneuptime.com › home › blog › kotlin file io
Kotlin File IO
February 2, 2026 - The File class gains numerous Kotlin-specific extensions that eliminate boilerplate code while ensuring resources are properly closed.
🌐
Kotlin
kotlinlang.org › api › kotlinx-io › kotlinx-io-core › kotlinx.io.files › -file-system
FileSystem | kotlinx-io – Kotlin Programming Language
If a FileSystem needs to be accessed from multiple threads, an additional synchronization is required. ... Atomically renames source to destination overriding destination if it already exists. ... Creates a directory tree represented by the path. If path already exists then the method throws kotlinx.io...
🌐
Android Developers
developer.android.com › api reference › file
File | API reference | Android Developers
Skip to main content · English · Deutsch · Español – América Latina · Français · Indonesia · Polski · Português – Brasil · Tiếng Việt · 中文 – 简体
🌐
W3cubDocs
docs.w3cub.com › kotlin › docs › tutorials › kotlin-for-py › file-io
File I/O - Kotlin - W3cubDocs
Kotlin has inherited Java's fidgety (but very flexible) way of doing I/O, but with some simplifying extra features. We won't get into all of it here, so for starters, this is how to iterate through all the lines of a file (you'll need import java.io.File):
🌐
Alvin Alexander
alvinalexander.com › kotlin › io-in-kotlin-reading-writing-files-command-line-console
I/O in Kotlin: Reading and writing files and command line input/output | alvinalexander.com
There are a number of ways to read text files in Kotlin. While this approach isn’t recommended for large text files, it’s a simple way to read small-ish text files into a List<String>: import java.io.File fun readFile(filename: String): List<String> = File(filename).readLines() This is how you use that function to read the /etc/passwd file: val lines = readFile("/etc/passwd") And here are two ways to print all of those lines to STDOUT: lines.forEach{ println(it) } lines.forEach{ line -> println(line) } As a quick reference, here are a few other ways to read text files in Kotlin: fun readFi
🌐
Baeldung
baeldung.com › home › kotlin › kotlin io › reading from a file in kotlin
Reading from a File in Kotlin | Baeldung on Kotlin
April 28, 2026 - In this article, we saw the various ways of reading a file in Kotlin. Depending on the use case, we can either opt for reading the file line-by-line or reading it entirely as a text.
🌐
N=1 Lifestyle
nequalsonelifestyle.com › 2020 › 11 › 16 › kotlin-native-file-io
File I/O in Kotlin Native •
November 16, 2020 - Pure Kotlin libraries can be made to compile easily for whichever platform you are targeting your KN binary for. There are a growing number of libraries for KN and Kotlin Multiplatform, which also allows targeting of iOS, Android, JavaScript, etc. One thing that is still missing however from the Kotlin standard libraries for KN is basic File I/O.
🌐
Kotlin
kotlinlang.org › api › latest › jvm › stdlib › kotlin.io
kotlin.io - Kotlin Programming Language
February 15, 2023 - The Kotlin Standard Library provides ... with Kotlin. These include: Higher-order functions implementing idiomatic patterns (let, apply, use, synchronized, etc). Extension functions providing querying operations for collections (eager) and sequences (lazy). Various utilities for working with strings and char sequences. Extensions for JDK classes making it convenient to work with files, IO, and ...
🌐
GitHub
github.com › Archinamon › native-file-io
GitHub - Archinamon/native-file-io: File IO library based on Posix API for Kotlin/Native
January 27, 2019 - File IO library based on Posix API for Kotlin/Native - Archinamon/native-file-io
Starred by 21 users
Forked by 3 users
Languages   Kotlin 100.0% | Kotlin 100.0%
🌐
YouTube
youtube.com › watch
Working With Files In Kotlin - IO Essentials - YouTube
In this video you'll learn about files in JVM based environments, specifically about referencing files and folders in our code, file permissions and traversi...
Published   January 19, 2025
🌐
Kotlin
kotlinlang.org › api › latest › jvm › stdlib › kotlin.io › java.io.-file › read-text.html
readText - Kotlin Programming Language
December 30, 2022 - The Kotlin Standard Library provides ... with Kotlin. These include: Higher-order functions implementing idiomatic patterns (let, apply, use, synchronized, etc). Extension functions providing querying operations for collections (eager) and sequences (lazy). Various utilities for working with strings and char sequences. Extensions for JDK classes making it convenient to work with files, IO, and ...
🌐
Medium
medium.com › @ramtintoosi › android-storage-i-o-with-kotlin-6fbef9489eb7
Android Storage I/O with Kotlin. First when I started working on Android… | by Arrowsome | Medium
June 8, 2022 - For appending (adding) text to the current file, you should get a connection stream and enable appending on that stream. Please let me know If there is something in this article that needs more explaining or there is any type of error is it. You can download the full sample with the usage of Kotlin Coroutines here: https://github.com/Arrowsome/android-storage-io-sample