gios / gzipper

CLI for compressing files.
https://www.npmjs.com/package/gzipper
GNU General Public License v3.0
68 stars 13 forks source link

Skip file if compressed version already exist #73

Closed vanhanit closed 3 years ago

vanhanit commented 3 years ago

It would be nice to be able to only compress files where the corresponding compressed version does not exist.

For example, when file image.png is the current file to compress but image.png.gz exists it would skip that file and continue with the next. This would help in instances where static files are pre-compressed but mixed in with other non pre compressed files. The flag could be something like --skip-compressed or maybe --skip-pre-compressed. Maybe even --skip-when-output-exists or something more specific. Proposed flag names are a bit long but the function is hopefully clear.

Thank you for this great tool!

gios commented 3 years ago

Hi, @vanhanit,

This functionality has already been implemented through incremental compilation. This is a special type of compilation that validates file checksums and compiles only necessary files. You can find more details and how to use it in README.md.

vanhanit commented 3 years ago

Isn't it so that the incremental only works if you have a map of the hash values stored? The suggested feature here is to just compressing files that already exist. We use this in a deployment and therefore we can't run an incremental compression because we don't store the result after each build and deployment.

gios commented 3 years ago

Got it, I'll add this to the next milestone. Thanks for the idea.