Listing contents and sizes of files in a ZIP archive

Report a typo

Create a program that opens a ZIP file, moves through its contents, and displays details about each file inside the archive. This includes the file name and its size in bytes.

Reorder lines using drag or arrows. Adjust indentation with left buttons
                }
              
                fun main() {
              
                ZipFile(zipFilePath).use { zip ->
              
                }
              
                import java.util.zip.ZipFile
              
                val zipFilePath = "path/to/your/zipfile.zip"
              
                }
              
                println("${entry.name}: ${entry.size} bytes")
              
                zip.entries().asSequence().forEach { entry ->
              

Create a free account to access the full topic