MCPcopy Create free account
hub / github.com/Effect-TS/effect / make

Function make

packages/platform/node-shared/src/NodeHttpCompression.ts:87–101  ·  view source on GitHub ↗
(fallback: Platform.Compression)

Source from the content-addressed store, hash-verified

85 * @since 4.0.0
86 */
87export const make = (fallback: Platform.Compression): Platform.Compression => ({
88 algorithms: fallback.algorithms,
89 compressResponse(response, algorithm, options) {
90 const body = response.body
91 if (body._tag !== "Uint8Array") {
92 return fallback.compressResponse(response, algorithm, options)
93 }
94 return Effect.map(compress(body.body, algorithm, options), (result) =>
95 Response.setHeader(
96 Response.setBody(response, HttpBody.uint8Array(result, body.contentType)),
97 "content-length",
98 result.byteLength.toString()
99 ))
100 }
101})
102
103/**
104 * Creates a `node:zlib` compression transform stream that flushes each input

Callers 1

NodeTerminal.tsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected