use HUFFMAN encoding for large files (seems to work)

This commit is contained in:
zefie
2021-08-13 17:01:35 -04:00
parent f5e5289052
commit 1127f8def7

View File

@@ -615,8 +615,10 @@ async function sendToClient(socket, headers_obj, data) {
case 2: case 2:
// zlib DEFLATE implementation // zlib DEFLATE implementation
var zlib_options = { 'level': 9 };
if (uncompressed_content_length > 4194304) zlib_options.strategy = 2;
headers_obj['Content-Encoding'] = 'deflate'; headers_obj['Content-Encoding'] = 'deflate';
data = zlib.deflateSync(data, { 'level': 9 }); data = zlib.deflateSync(data, zlib_options);
break; break;
} }