Questions tagged [sharpziplib]

#ziplib (SharpZipLib) is a Zip, GZip, Tar and BZip2 library written entirely in C# for the .NET platform.

The #ziplib (SharpZipLib) is a Zip, GZip, Tar and BZip2 library written entirely in C# for the .NET platform. It is implemented as an assembly (installable in the GAC), and thus can easily be incorporated into other projects (in any .NET language). The creator of #ziplib put it this way: "I've ported the zip library over to C# because I needed gzip/zip compression and I didn't want to use libzip.dll or something like this. I want all in pure C#."

Reference: http://www.icsharpcode.net/opensource/sharpziplib/

Installation

SharpZipLib can most easily be installed through its NuGet package.

Install-Package SharpZipLib
272 questions
4
votes
4 answers

Unzip .tar.gz with SharpZipLib

I am trying to unzip a tar.gz inside one zip but I can't It shows me an error “cannot find central directory” and I don’t know what to do. First I unzip the zip on a temporal folder, then search for a .tar.gz on that folder and try to unzip but…
J.Calmet
  • 61
  • 1
  • 1
  • 7
4
votes
2 answers

C# EndOfStream always true - Seek/Position to 0 not works

I want to detect the encoding of a XML document before parsing it. So I found on stackoverflow this script. public static XElement GetXMLFromStream(Stream uploadStream) { /** Remember position */ var position = uploadStream.Position; …
Patrick
  • 829
  • 2
  • 13
  • 34
4
votes
4 answers

Basics of SharpZipLib. What am I missing?

I have the following method in my code: private bool GenerateZipFile(List filesToArchive, DateTime archiveDate) { try { using (ZipOutputStream zipStream = new ZipOutputStream(File.Create(GetZipFileName(archiveDate)))) …
Yes - that Jake.
  • 16,725
  • 14
  • 70
  • 96
4
votes
1 answer

Problems opening .xlsx file created with EPPlus and zipped in a folder with ICSharpCode.SharpZipLib

I am creating a list of ExcelPackages (xlsx documents) using EPPlus, and adding them to a ZipOutputStream as ZipEntries. I think the Excel documents should be valid, as I can open them just fine when I write one of them to the Response object…
4
votes
1 answer

How do I add files to an archive using SharpZipLib with no compression?

How do I add files to a Zip archive using SharpZipLib with no compression? Examples on Google seem to be woefully thin.
Josh Kodroff
  • 27,301
  • 27
  • 95
  • 148
4
votes
1 answer

PHP => Inflate GZipped string coming from C# SharpZipLib?

i have a C# application where i am using SharpZipLib to deflate a very long string and then send the data over to a PHP Service in a Base64 string of the deflated byte[]. For some reason, when trying to Inflate it on the PHP side, it is returning an…
SlashJ
  • 687
  • 1
  • 11
  • 31
4
votes
3 answers

Extract zip entries to another Zip file

Can anyone tell me why the following code doesnt work? I am using the SharpZipLib API for the Zip streams, latest version DL'ed today from their site. Im attempting to use this logic to merge the contents of one zip file into another, without having…
Mark W
  • 2,791
  • 1
  • 21
  • 44
3
votes
1 answer

No Encoding for Name field is specified, any non-ASCII bytes will be discarded

The following .NET 5.0 code using ICSharpCode.SharpZipLib var gzipInputStream = new GZipInputStream(sourceStream); var tarInputStream = new TarInputStream(gzipInputStream); var gZipOutputStream = new GZipOutputStream(destinationStream); var…
alik
  • 2,244
  • 3
  • 31
  • 44
3
votes
0 answers

System.OutOfMemoryException when tried with 70 files SharpZipLib

I have tried zipping 70 pdf documents but ended up having a System.OutOfMemoryException. Please look into the following code and let me know whats wrong with it. Please note that I have posted issue on GitHub as well. public byte[]…
3
votes
3 answers

How do I extract zip file in Windows Phone 7?

I have a zip file in my Windows Phone 7 project. I have set the Build Action to Content and Copy to output directory to Always. The zip file contains the folder structure. I want this to be copied entirely as it is in my Phone Project. I am using…
TCM
  • 16,780
  • 43
  • 156
  • 254
3
votes
0 answers

c# zip multiple files and download - can't open file in windows explorer

I use the SharpZipLib for zipping multiple files and download them in my asp.net c# web app. After the download I can't open the zip archive. Windows error message is: Windows cannot open the folder. The Compressed (zipped) Folder 'filename.zip'…
raven_977
  • 475
  • 2
  • 8
  • 25
3
votes
0 answers

Extract .tar.gz Contents into Folder using SharpZipLib - C#

I'm using SharpZipLib to extract a .tar.gz file using this code: new FastZip().ExtractZip(source, destination, null); But the program will give the error below: ICSharpCode.SharpZipLib.Zip.ZipException: 'Cannot find central directory' I can…
Mohammad Almasi
  • 400
  • 6
  • 19
3
votes
1 answer

SharpZipLib extracted file size

Is there a way to find out what the total size of the unextracted archive would be when extracted.
maxfridbe
  • 5,872
  • 10
  • 58
  • 80
3
votes
2 answers

Unzip a zip file that is inside another zip with SharpZipLib

I 'm trying to unzip a zip file that is inside another zip. When I try to get the FileStream of the second zip it gives me an error. How I could view the content? This is my code: try { FileStream fs = File.OpenRead(location); …
imj
  • 472
  • 1
  • 8
  • 24
3
votes
1 answer

sharpziplib + extracting single file

Whenever i try to get the file, the length of the input stream (s.Length) is always zero, what am i doing wrong? ZipEntry is valid and has the proper size of the file, etc. Here is the code im using: public static byte[] GetFileFromZip(string…
schmoopy
  • 6,419
  • 11
  • 54
  • 89
1 2
3
18 19