In kotlin if I have an existing file how do I go about zipping it. For example I create a new File() and I append content to it. Now after appending the content to it. I want to zip this file.
All other solutions I have come across haven't been of help. I am assuming this is straight forward but I am finding trouble how to do this.
val fdir = filesDir
fdir.resolve("sometextfile.txt").takeIf { !it.exists() }?.appendText(text)
val sometextfile = fdir.resolve("sometextfile.txt")
// I now want sometextfile.txt in a zip file called somezipfile.zip
how can I put sometextfile.txt into a zip file called somezipfile.zip so that when it is unzip it contains sometextfile.txt?