DeflateStream 4GB Limit in .NET

2019-01-19 19:17发布

From MSDN: DeflateStream Class

DeflateStream cannot be used to compress files larger than 4 GB.

Are there any other implementations for .NET without the 4 GB limit?

NOTE: I really need to decompress a file in GZ format with content larger than 4 GB. Can any code do that?

7条回答
爱情/是我丢掉的垃圾
2楼-- · 2019-01-19 19:21

Look for libraries that support DEFLATE64 (not Zip64, that's an extension to the ZIP file format). Xceed Zip for .NET does support Deflate64, and I'm sure others do too.

查看更多
叼着烟拽天下
3楼-- · 2019-01-19 19:37

DotNetZip does ZIP64 for .NET, and it is free. But Zip64 is not the same as Deflate64.

查看更多
ら.Afraid
4楼-- · 2019-01-19 19:38

Although that documentation says the 4GB limitation is for both the DeflateStream and GZipStream, only GZipStream is limited because of the CRC32 checksum. If you do not need CRC32 then use DeflateStream.

查看更多
叛逆
5楼-- · 2019-01-19 19:39

Having a look around, it seems a lot of people have encountered this problem. System.IO.Compressio.DeflateStream clarifications please seems to be the most comprehensive.

The only implementation I was able to find that seems to overcome this problem by using Zip64 is Xceed Zip for .NET.

However, it is very expensive and I am not sure if it would suite your needs.

Edit:

There does seem to be quite a number of implementations of Zip64 for .NET, but I can't find any that are free.

查看更多
狗以群分
6楼-- · 2019-01-19 19:41

Take a look at SharpZipLib. Not sure if it's subject to the same limitation, but worth a look.

查看更多
不美不萌又怎样
7楼-- · 2019-01-19 19:43

FYI, we have removed the 4 GB limit from DeflateStream in .NET 4.

查看更多
登录 后发表回答