keryx 0.14.2 → 0.14.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/util/webCompression.ts +4 -0
package/package.json
CHANGED
package/util/webCompression.ts
CHANGED
|
@@ -112,6 +112,7 @@ export async function compressResponse(
|
|
|
112
112
|
const format: Bun.CompressionFormat = encoding === "br" ? "brotli" : "gzip";
|
|
113
113
|
// @ts-ignore Bun supports "brotli" as CompressionFormat but DOM lib does not
|
|
114
114
|
const compressionStream = new CompressionStream(format);
|
|
115
|
+
// @ts-ignore Bun's ReadableStream type is incompatible with Node/DOM ReadableStream
|
|
115
116
|
const stream = new Blob([body]).stream().pipeThrough(compressionStream);
|
|
116
117
|
|
|
117
118
|
const headers = new Headers(response.headers);
|
|
@@ -119,6 +120,7 @@ export async function compressResponse(
|
|
|
119
120
|
headers.append("Vary", "Accept-Encoding");
|
|
120
121
|
headers.delete("Content-Length");
|
|
121
122
|
|
|
123
|
+
// @ts-ignore Bun's ReadableStream type is incompatible with Node/DOM ReadableStream
|
|
122
124
|
return new Response(stream, {
|
|
123
125
|
status: response.status,
|
|
124
126
|
headers,
|
|
@@ -129,6 +131,7 @@ export async function compressResponse(
|
|
|
129
131
|
const format: Bun.CompressionFormat = encoding === "br" ? "brotli" : "gzip";
|
|
130
132
|
// @ts-ignore Bun supports "brotli" as CompressionFormat but DOM lib does not
|
|
131
133
|
const compressionStream = new CompressionStream(format);
|
|
134
|
+
// @ts-ignore Bun's ReadableStream type is incompatible with Node/DOM ReadableStream
|
|
132
135
|
const stream = response.body.pipeThrough(compressionStream);
|
|
133
136
|
|
|
134
137
|
const headers = new Headers(response.headers);
|
|
@@ -136,6 +139,7 @@ export async function compressResponse(
|
|
|
136
139
|
headers.append("Vary", "Accept-Encoding");
|
|
137
140
|
headers.delete("Content-Length");
|
|
138
141
|
|
|
142
|
+
// @ts-ignore Bun's ReadableStream type is incompatible with Node/DOM ReadableStream
|
|
139
143
|
return new Response(stream, {
|
|
140
144
|
status: response.status,
|
|
141
145
|
headers,
|