Add support for -r (recursive) flag in the Linux CLI #425

Open
opened 2026-01-29 20:43:37 +00:00 by claunia · 2 comments
Owner

Originally created by @janvladimirmostert on GitHub (May 27, 2022).

I'm pre-zipping static content before bundling it in a Docker container.
This allows me to serve static content gzipped if there's an accept-encoding header that contains gzip without putting extra load on the CPU when serving gzipped content.
gzip -rk9 ./build/processedResources/jvm/main/static/* || exit

I wanted to add support for Brotli if the accept-encoding header contains br and then serve whichever one is smaller, file.ext.br or file.ext.gz
brotli -rk9 ./build/processedResources/jvm/main/static/* || exit

Turns out -k and -9 does exactly the same as gzip, but the -r flag is not supported which caught me by surprise.

Short-term workaround is to use find ... | args ... | brotli -k9 after I've extensively studied the find and xargs man pages, long-term, it would be nice if I can just do -r and save the hassle of using 3 commands to do one thing.

Originally created by @janvladimirmostert on GitHub (May 27, 2022). I'm pre-zipping static content before bundling it in a Docker container. This allows me to serve static content gzipped if there's an `accept-encoding` header that contains `gzip` without putting extra load on the CPU when serving gzipped content. `gzip -rk9 ./build/processedResources/jvm/main/static/* || exit ` I wanted to add support for Brotli if the `accept-encoding` header contains `br` and then serve whichever one is smaller, file.ext.br or file.ext.gz `brotli -rk9 ./build/processedResources/jvm/main/static/* || exit ` Turns out `-k` and `-9` does exactly the same as `gzip`, but the `-r` flag is not supported which caught me by surprise. Short-term workaround is to use `find ... | args ... | brotli -k9` after I've extensively studied the `find` and `xargs` man pages, long-term, it would be nice if I can just do `-r` and save the hassle of using 3 commands to do one thing.
claunia added the featurerelease-v1.1.1 labels 2026-01-29 20:43:37 +00:00
Author
Owner

@eustas commented on GitHub (May 27, 2022):

Oh, never noticed that option in gzip. Sounds like a good addition. Will implement it, when I have spare cycles. Thanks for the heads-up.

@eustas commented on GitHub (May 27, 2022): Oh, never noticed that option in gzip. Sounds like a good addition. Will implement it, when I have spare cycles. Thanks for the heads-up.
Author
Owner

@Enelar commented on GitHub (Jul 21, 2022):

+1 To this issue, we using gzip --best -r . for our docker nginx images and gzlp_static on;

@Enelar commented on GitHub (Jul 21, 2022): +1 To this issue, we using `gzip --best -r .` for our docker nginx images and `gzlp_static on;`
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/brotli#425