There are many good implementations of a zipping, however they can be overhead in many cases. This crate fills the niche.
First you need to create a zip file by calling:
let mut zip = simzip::ZipInfo::new_with_comment("test.zip",
"Generated by WebFolder (Java nio) 1.9.155 © 2026 Dmitriy Rogatkin");Then you can add zip entries using:
zip.add(simzip::ZipEntry::new(".gitignore", r#"src/test
test.zip"#.as_bytes().to_vec()));Or from a file content:
zip.add(simzip::ZipEntry::from_file("README.md", Some("doc")));A zip entry attributes can be changed using the followin technique:
entry.attributes.insert(simzip::Attribute::Exec);Finally you can store the zip in the file system by calling:
match zip.store() {
Ok(()) => println!{"Zipped good!"},
Err(msg) => println!{"zip error: {msg}"}
}The underline code will automatically add correct file permissions on UNIX systems.
There is nothing to prevent you to continue adding content after the storing, and
then to store the zip again. But remember that repeating storing will overwrite a
previosly stored zip unless you change its name. A repeating store can be
useful in a case of an error like an insufficient disk space hoping that after some time
more space will be available.
- A created zip file can't exceed 2GB.
- A zip entry can't exceed available RAM size.
- Streaming can't be used, because some parts of the zip content gets updated after the initial writing.
Obtain the RustBee first. It's an alternative tool to Cargo. You may need to build it for your platform. (Since RustBee uses the crate for itself, the crate also gets built as a part of its bootstraping procedure)
The crate has one dependency simtime.
It has to be built in the common location
specified in bee.7b as crate_dir variable.
Running the rb will create the simzip crate.
if you plan to deflat zip entires, then set
the build script
variable use deflater to true (default value).
Use deflater/bee.7b to build the libdeflater crate. Read instructions inside the bee.7b how to build it.
Note that an actual deflat code is C and requires cmake tool to be built, however if you are on Windows platform and x64 processor, a precompiled object files included in the deflat repository.
- More compressing algorithms (including encryption) can be added in the future.
- Releasing the limitation having ZIP file under 2 GB, and adding 64 bit format support.
- Adding unzipping capabilities.