keryx 0.14.1 → 0.14.2
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 -4
package/package.json
CHANGED
package/util/webCompression.ts
CHANGED
|
@@ -111,9 +111,8 @@ export async function compressResponse(
|
|
|
111
111
|
// Compress the buffered body
|
|
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
|
-
const
|
|
115
|
-
|
|
116
|
-
.pipeThrough(new CompressionStream(format));
|
|
114
|
+
const compressionStream = new CompressionStream(format);
|
|
115
|
+
const stream = new Blob([body]).stream().pipeThrough(compressionStream);
|
|
117
116
|
|
|
118
117
|
const headers = new Headers(response.headers);
|
|
119
118
|
headers.set("Content-Encoding", encoding);
|
|
@@ -129,7 +128,8 @@ export async function compressResponse(
|
|
|
129
128
|
// Content-Length is present and above threshold — stream-compress
|
|
130
129
|
const format: Bun.CompressionFormat = encoding === "br" ? "brotli" : "gzip";
|
|
131
130
|
// @ts-ignore Bun supports "brotli" as CompressionFormat but DOM lib does not
|
|
132
|
-
const
|
|
131
|
+
const compressionStream = new CompressionStream(format);
|
|
132
|
+
const stream = response.body.pipeThrough(compressionStream);
|
|
133
133
|
|
|
134
134
|
const headers = new Headers(response.headers);
|
|
135
135
|
headers.set("Content-Encoding", encoding);
|