-
-
Notifications
You must be signed in to change notification settings - Fork 547
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(serveStatic): add precompressed
option
#3366
Conversation
Hi @inetol Thank you for the PR. It's interesting. But, is there any specification of |
AFAIK, it looks more like a helper to me, nginx and Caddyserver have a dedicated directive to this but at no time it is said that it is part of a spec, so its implementation may differ. In cases where for some reason it is not possible to compress a file at the time of the request (because its too large, because the server is not compatible or for other reasons) this may be a solution. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## next #3366 +/- ##
==========================================
+ Coverage 95.77% 95.78% +0.01%
==========================================
Files 152 152
Lines 9187 9211 +24
Branches 2818 2681 -137
==========================================
+ Hits 8799 8823 +24
Misses 388 388 ☔ View full report in Codecov by Sentry. |
I haven't checked the detailed implementation, but I think it's a good feature for Hono, which prioritizes performance. As far as I searched, Fastify, Koa, and SvelteKit have similar features. It would be worth implementing. |
Someone from the community has created this PR for the node server |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@ryuapp @MathurAditya724 Thanks for your comment. Looks good! I'll merge this into the @inetol Thank you for your contribution! |
Closes #3363
Allows to serve all compatible pre-compressed files transparently to the client, otherwise fallback to serve the original file.
In case there are several files with various encodings (e.g., .gz and .br), it has priority to use brotli, then zstd and finally gzip.
The author should do the following, if applicable
bun run format:fix && bun run lint:fix
to format the code