What is the simplest way to read/write .ZIP files?

I would like a simple way to read and write compressed folders, the folders would contain some data files.

Do you want to extract the archives into the filesystem and compress the folders from the filesystem? Or do you want to extract into memory and compress from memory? Most libraries focus on one over the other.

I want a library that treats a .zip file like a folder.

If you search for "zip" on crates.io the top result is the zip crate, which has over 6.5 million downloads and calls itself "A zip library for rust which supports reading and writing of simple ZIP files".

Once you load the ZipArchive, you should be able to call its by_name() method to find any file you want by name. You can use the file_names() method to get an iterator over the names for all the files in the archive.

4 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.