~What is the entry point for `squareup.okio` on th...
# multiplatform
d
What is the entry point for
squareup.okio
on the shared code? The doc uses
File
which is only a jvm type
Oh, nvm, I just looked at the source code and noticed that only jvm is implemented 😅 So, what is the best way for handle files on shared code? Basically I need to write a file and read its name
a
So, I did this recently have not tested this quite well on iOS so you might need to test it well. But what you need is to define
expect
declarations in common module and then
actual
declarations in
iosMain
and
androidMain
(jvm implementation). For eg:
Copy code
In common,
expect class FileUtils(path: String) {
    fun readFile(): String
}
In androidMain,
actual class FileUtils actual    constructor(path: String){
   fun readFile() = File(path).readText()
}
In ioS main similarly,
you can do in actual NSString.stringWithContentsOfFile(
                    rootPath,
                    NSUTF8StringEncoding,
                    null
            )
``````
d
I don't really need to read the content of the file, but write an archive (let's suppose it's a zip) to disk and read the file names into a folder
a
yup all file dependent features are platform dependent then in this case of zip you need to create zip in JVM and ios in both
actuals
.
👍 1
d
I was hoping in a MP library
a
Yup I also tried to find it but couldn't let me also know if you find one.