diff --git a/lib/util/compress.ts b/lib/util/compress.ts index 4cd3e6a4b0cbd98ab3218f799d73a489e57c5405..dd97c1aefbe6bc571d3dc7ae41627bc76409093f 100644 --- a/lib/util/compress.ts +++ b/lib/util/compress.ts @@ -1,11 +1,16 @@ import { promisify } from 'node:util'; -import zlib from 'node:zlib'; +import zlib, { constants } from 'node:zlib'; const brotliCompress = promisify(zlib.brotliCompress); const brotliDecompress = promisify(zlib.brotliDecompress); export async function compress(input: string): Promise<string> { - const buf = await brotliCompress(input); + const buf = await brotliCompress(input, { + params: { + [constants.BROTLI_PARAM_MODE]: constants.BROTLI_MODE_TEXT, + [constants.BROTLI_PARAM_QUALITY]: 8, + }, + }); return buf.toString('base64'); }