You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+25-5
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ Drop-in replacement of the built-in [Compress Middleware](https://hono.dev/docs/
8
8
9
9
- all available compression formats (`zstd`, `brotli`, `gzip`, `deflate`)
10
10
- ultra-fast and 100% type-safe
11
-
-auto best format selection
11
+
- best format auto-selection
12
12
- streaming response support
13
13
- configurable compression level and zlib options
14
14
- double-compressed content protection
@@ -101,16 +101,18 @@ Can be one of the following:
101
101
-`gzip`
102
102
-`deflate`
103
103
104
-
If not defined, all the supported encodings are allowed based on the request header `Accept-Encoding` and will be used in their order of declaration.
104
+
If not defined, all the formats defined in the option `encodings` are allowed.
105
105
106
-
This option is provided mainly to maintain compatibility with `hono/compress`, it's recommended to set the compression formats using `encodings`instead.
106
+
This option is provided primarily to maintain compatibility with `hono/compress`; it is recommended to use the option `encodings`to set the wanted compression formats.
107
107
108
108
#### encodings
109
109
110
110
Defaults to `['zstd', 'br', 'gzip', 'deflate']`.
111
111
112
112
The compression formats allowed to be used to compress the response content.
113
113
114
+
The first format matching the request header `Accept-Encoding` is chosen to be used to compress the response content.
115
+
114
116
#### threshold
115
117
116
118
Defaults to `1024`.
@@ -131,7 +133,7 @@ Defaults to `4`.
131
133
132
134
Brotli algorithm compression level.
133
135
134
-
Refer to the Brotli [website](https://www.brotli.org/) for more details.
136
+
Refer to the Brotli [specification](https://www.ietf.org/rfc/rfc7932.txt) for more details.
135
137
136
138
#### zlibLevel
137
139
@@ -153,7 +155,25 @@ Refer to the node zlib [documentation](https://nodejs.org/api/zlib.html) for mor
153
155
154
156
Defaults to `undefined`.
155
157
156
-
A function callback to state if response content should be compressed or not.
158
+
An optional function callback to state if the response content should be compressed or not.
By default, content compression is disabled on Cloudflare Workers and Deno Deploy, a custom filter can be used to bypass this behavior and force the response to be always compressed:
0 commit comments