#zip #deterministic #zip-archive #file #directory #cli #zipfiles

app deterministic-zip

A tool to generate consistent Zip files

4 releases

0.0.4 Mar 9, 2020
0.0.3 Mar 9, 2020
0.0.2 Dec 9, 2019
0.0.1 Dec 8, 2019

#461 in Compression

MIT license

9KB
155 lines

Deterministic zip 🗄

Crates.io Actions Status

Regular zip utilities do not create deterministic zipfiles when given identical content. Things like the file modification times, directory iteration ordering and file permissions can change the hash of the zip file.

This is particularly annoying when using terraform with AWS Lambda. Without this tool every rebuild of the lambda source would result in a zip file with a different hash which would result in the lambda being re-deployed even if the source had not changed.

Install 💿

Homebrew (MacOS, Linux)

brew tap orf/brew, then brew install deterministic-zip

Cargo

cargo install deterministic-zip

Github releases

Download a prebuilt binary from the releases page

Usage 📀

The command is run like so: deterministic-zip [output-file] [files...]

For example: deterministic-zip output.zip my-source-code/

You can customize the compression with --compression.

Alternatives 🌎

https://github.com/bboe/deterministic_zip and https://www.npmjs.com/package/deterministic-zip

Dependencies

~2.9–4MB
~64K SLoC