Use CompressionLevel.SmallestSize in Bundler (#80372)
authorStephen Toub <stoub@microsoft.com>
Tue, 17 Jan 2023 13:02:30 +0000 (08:02 -0500)
committerGitHub <noreply@github.com>
Tue, 17 Jan 2023 13:02:30 +0000 (08:02 -0500)
src/installer/managed/Microsoft.NET.HostModel/Bundle/Bundler.cs

index 14315ed..47d7a35 100644 (file)
@@ -101,7 +101,8 @@ namespace Microsoft.NET.HostModel.Bundle
 
                 // We use DeflateStream here.
                 // It uses GZip algorithm, but with a trivial header that does not contain file info.
-                using (DeflateStream compressionStream = new DeflateStream(bundle, CompressionLevel.Optimal, leaveOpen: true))
+                CompressionLevel smallestSize = (CompressionLevel)3;
+                using (DeflateStream compressionStream = new DeflateStream(bundle, Enum.IsDefined(typeof(CompressionLevel), smallestSize) ? smallestSize : CompressionLevel.Optimal, leaveOpen: true))
                 {
                     file.CopyTo(compressionStream);
                 }