<PackageReference Include="BouncyCastle.Cryptography" Version="2.6.0" />

ZLib

static class ZLib
using Org.BouncyCastle.Utilities.Zlib; using System.IO; namespace Org.BouncyCastle.Utilities.IO.Compression { internal static class ZLib { internal static Stream CompressOutput(Stream stream, int zlibCompressionLevel, bool leaveOpen = false) { if (!leaveOpen) return new ZOutputStream(stream, zlibCompressionLevel, false); return new ZOutputStreamLeaveOpen(stream, zlibCompressionLevel, false); } internal static Stream DecompressInput(Stream stream, bool leaveOpen = false) { if (!leaveOpen) return new ZInputStream(stream); return new ZInputStreamLeaveOpen(stream); } } }