Join Slack
Powered by
Hi ! I'm trying to zip a folder recursevily with O...
# squarelibraries
l
loloof64
06/11/2024, 1:40 PM
Hi ! I'm trying to zip a folder recursevily with Okio and Kotlin, but the produced zip has nothing in it. Code in 🧵
loloof64
06/11/2024, 1:41 PM
compress folder recursively.kt
compress folder recursively.kt
j
jw
06/11/2024, 1:47 PM
If you have access to ZipOutputStream is there a reason to use Okio? You could create a new nio zip FileSystem in a new file, get it's root nio Path, and then use
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.io.path/java.nio.file.-path/copy-to-recursively.html
and be done in like 3 lines.
l
loloof64
06/11/2024, 1:48 PM
Thank you. I was just using Okio because I added it in my project for handling file system more easily. I'll have a look at your link right now 😃
j
jw
06/11/2024, 1:48 PM
I'll be at a computer soon. I'll figure out what's wrong with the original code and show you the (arguably superior) NIO code
👍 1
l
loloof64
06/11/2024, 1:48 PM
Thank you very much 🙂
loloof64
06/11/2024, 5:50 PM
I've tried a code like this, but it doesn't work. It fails saying that the zip file already exists.
compressElement (2nd version).kt
42
Views
Open in Slack
Previous
Next