在读取文件时解压缩文件 [英] Unzip file while reading it

查看:127
本文介绍了在读取文件时解压缩文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有数百个CSV文件压缩。这是伟大的,因为他们占用很少的空间,但当它是使用它们的时候,我必须在我的高清和一些空间,解压缩它们,我可以处理之前。我想知道是否可能与.NET解压缩文件读取它。换句话说,我想打开一个zip文件,开始解压缩文件,我们去,处理文件。

I have hundreds of CSV files zipped. This is great because they take very little space but when it is time to use them, I have to make some space on my HD and unzip them before I can process. I was wondering if it is possible with .NET to unzip a file while reading it. In other words, I would like to open a zip file, start to decompress the file and as we go, process the file.

因此,我的驱动器上不需要额外的空间。任何想法或建议?

So there would be no need for extra space on my drive. Any ideas or suggestions?

推荐答案

是的。 Zip是一种流式格式,这意味着您可以在解压缩时使用数据,而不必首先解压缩所有数据。

Yes. Zip is a streamed format which means that you can use the data as you decompress it rather than having to decompress everything first.

使用.net的System.IO.Compression类可以对zip文件(Deflate& GZip)应用类似的压缩到任何你喜欢的流,但如果你想使用真正的zip格式文件,你将需要一个第三方库喜欢这个(sharpziplib)。

With .net's System.IO.Compression classes you can apply similar compression as used in zip files (Deflate & GZip) to any stream you like, but if you want to work with actual zip format files you'll need a third party library like this one (sharpziplib).

这篇关于在读取文件时解压缩文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆