I posted this question recently on the r/Kotlin subreddit (here). Afterwards I thought that I might get better answers here, since I really enjoy this community. I’d be glad if you could help me!
I’m trying to find the best way to interact with a filesystem and do basic operations on it (I/O). My requirements would be:
basically anything that is more advanced than basic CRUD
I don’t think it’s a good idea to wait for kotlinx.io *, so what could other alternatives be? The last option would be to implement it with expect / actual for every platform, but maybe there’s already a fitting library for this? Maybe korio? Does anyone have experience with it, is it up-to-date and well usable?
Thanks for your input!
* I get it that they don’t want to waste their resources on something that is low-priority, but I really don’t understand why such an essential thing as multiplatform I/O is considered “low priority”. Sad story.
First of all, thanks for the replies. Indeed, as @arocnies pointed out, I would not need anything “advanced” when it comes to the filesystem API. Basically, my goal with trying to go multiplatform is to be a maximally inclusive library. So when @skylen asks how it should work in a browser env, I have to admit that I have no idea. And that is because I do not intend to use it with Kotlin/JS, but I want to provide this possibilty for others. Considering this, a VFS interface for browser environments would probably be the best choice, so that library users can decide on their own how FS interaction in a browser should look like.
Apart from that the minimal requirements for me would really just be:
read text from file
adress file by path
some path composition utilities
NIO
If anyone can recommend a library for that, I’d be thankful. korio seems promising, and I also got okio recommended. Does anyone know these libs and can tell me whether they are proper and also fitting my use case?
I’m sure moko-resources is great, but I actually don’t want to target mobile primarily (although it might be yet another supported platform for my multiplatform project). My most important target is JVM, although I also want to support native and (if possible, see earlier discussion) JS.