New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SharpZipLib .FastZip.ExtractZip for zip file with 2 or more big data files ~1.5GB (which are not zip) outputs a partial result #729
Comments
Is this a single archive, or can you reproduce it with different content? |
I can reproduce with different content. |
How are you creating the file? Using SharpZipLib or something else? |
Tried to reproduce using these steps:
Analyzing that file using ArchiveDiag produces the following report: Everything seems to be read fine, and all files are listed. |
@piksel , I am not seeing the "Extract the Zip using FastZip.ExtractZip method" step. |
Program.cs: new ICSharpCode.SharpZipLib.Zip.FastZip().ExtractZip("../006.zip", "output", "");
|
Thanks for the quick response, @piksel. But had issues when tried to extract a zip file that was zipped by Windows Compression (By right clicking on the files/folders you want to zip -> Send to -> Compressed (zipped) folder. Of course used FastZip.ExtractZip method. Here is the code I used to create the data files: using System;
using System.Collections.Generic;
using System.IO;
using System.Security.Cryptography;
/// <summary>
/// This will be used by developers "ONLY" in order to play with the code during development.
/// </summary>
namespace DevPlayground
{
public class Program
{
static void Main()
{
List<int> fileSizesInMB = new List<int> { 1000, 2000, 1000, 100, 50 };
string folderPath = $"PATH_IN_YOUR_DRIVE";
CreateRandomFiles(fileSizesInMB, folderPath);
}
private static void CreateRandomFiles(IEnumerable<int> filesSize, string baseFolder)
{
Directory.CreateDirectory(baseFolder);
var filesAndSizeDic = new Dictionary<string, int>();
foreach (var size in filesSize)
{
string fileName = Guid.NewGuid().ToString();
string filePath = Path.Combine(baseFolder, fileName);
filesAndSizeDic[filePath] = size;
}
CreateRandomFiles(filesAndSizeDic);
}
private static void CreateRandomFiles(Dictionary<string,int> filesAndsizeInMb)
{
const int blockSize = 1024 * 8;
const int blocksPerMb = (1024 * 1024) / blockSize;
byte[] data = new byte[blockSize];
foreach (var fileAndSizeInMB in filesAndsizeInMb)
{
using (RNGCryptoServiceProvider crypto = new RNGCryptoServiceProvider())
{
using (FileStream stream = File.OpenWrite(fileAndSizeInMB.Key))
{
for (int i = 0; i < fileAndSizeInMB.Value * blocksPerMb; i++)
{
crypto.GetBytes(data);
stream.Write(data, 0, data.Length);
}
}
}
}
}
}
} |
Windows zip support is awful. I couldn't even create an archive: Even if I were able to create one, it might be some other specific thing about the .zip that causes the issue. You can generate a report of your file using the ArchiveDiag tool and put the result in a gist (it will create a .zip.html of the output). That way I can take a look at what the structure of your file, and perhaps determine what the problem is. |
Thanks @piksel, I ran the tool on a 5GB+3GB zip file that was created using "Windows Compression" feature. |
Yeah, those files use ...also, what do you mean by "Windows Encryption"? That the files existed on a bitlocker-encrypted NTFS volume? That has no impact on the zip-file, as the files are transparently decrypted on being read. |
@piksel , thank you! |
Steps to reproduce
1.Create a ZIP with 3 folders.
2.Put in one of the folders 2 big (1.5GB) data files or more (txt, File or any type but not a zip)
3.Extract the Zip using FastZip.ExtractZip method
Expected behavior
Getting the same files as in the zip before extracting it
Actual behavior
Only one of the big files is being extracted, the others do not appear.
Version of SharpZipLib 1.3.1
The text was updated successfully, but these errors were encountered: