开发者

.Net library for split volume zip files?

开发者 https://www.devze.com 2023-03-19 15:34 出处:网络
I need to create spanned (multi-volume) zip files using .Net, but I have been unable to find a librarythat enables me to do it.

I need to create spanned (multi-volume) zip files using .Net, but I have been unable to find a library that enables me to do it.

Spanned zip is a zip compressed file that is split among a number of files, which usually have extensions like .z00, .z01, and so on.

The library would have to be open-source or free, because I'm gonna use it for a open source project.

(it's a d开发者_如何学运维uplicate to this question, but there are no answers there and I'm not going for ASP specific anyway)


DotNetZip example:

int segmentsCreated ;
using (ZipFile zip = new ZipFile())
{
  zip.UseUnicode= true;  // utf-8
  zip.AddDirectory(@"MyDocuments\ProjectX");
  zip.Comment = "This zip was created at " + System.DateTime.Now.ToString("G") ;
  zip.MaxOutputSegmentSize = 100*1024 ; // 100k segments
  zip.Save("MyFiles.zip");

  segmentsCreated = zip.NumberOfSegmentsForMostRecentSave ;
}

if segmentsCreated comes back as 5, then you have the following files, each not more than 100kb in size.

  • MyFiles.zip
  • MyFiles.z01
  • MyFiles.z02
  • MyFiles.z03
  • MyFiles.z04

Edited To Note: DotNetZip used to live at Codeplex. Codeplex has been shut down. The old archive is still [available at Codeplex][1]. It looks like the code has migrated to Github:

  • https://github.com/DinoChiesa/DotNetZip. Looks to be the original author's repo.
  • https://github.com/haf/DotNetZip.Semverd. This looks to be the currently maintained version. It's also packaged up an available via Nuget at https://www.nuget.org/packages/DotNetZip/


DotNetZip allows you to do this. From their documentation:

The library supports zip passwords, Unicode, ZIP64, stream input and output, AES encryption, multiple compression levels, self-extracting archives, spanned archives, and more.


Take a look at the SevenZipSharp library. It supports multivolumes archives.

0

精彩评论

暂无评论...
验证码 换一张
取 消