Search code examples
c#.net7zip

Extract .7Z file using sevenzip doesn't work for larger files >1GB


The sevenzip extractor works fine and its good to extract small .7Z files. The same code when used to extract large file(1gb), getting the below exception.

enter image description here

SevenZipExtractor extractor = new SevenZipExtractor(@"\\Sourcepath\test_20191024143230.7z");
if (extractor.Check())
{
    using (var tmp = new SevenZipExtractor(@"\\DestinationPath\test"))
    {
        for (int i = 0; i < tmp.ArchiveFileData.Count; i++)
        {
            tmp.ExtractFiles(@"C:\Users\ot97813\RPC_CodeBase\UnZip File\ExtractPath\", tmp.ArchiveFileData[i].Index);
        }
    }
}

looked in all websites and I didn't find this doesn't support extraction of larger files. Note: The file is not encrypted or password protected.


Solution

  • This is not an answer, just a proof SevenZipExtractor that is working.

    using System;
    using SevenZipExtractor; // https://github.com/adoconnection/SevenZipExtractor
    using ByteSizeLib; // https://github.com/omar/ByteSize
    
    namespace ConsoleAppSevenZipExtractor
    {
        class Program
        {
            static void Main(string[] args)
            {
                using (ArchiveFile archiveFile = new ArchiveFile(@"C:\test.7z"))
                {
                    foreach (var entry in archiveFile.Entries)
                    {
                        Console.WriteLine($"{entry.FileName} with {ByteSize.FromBytes(entry.Size)}");
    
                        // extract to file to current path
                        entry.Extract(entry.FileName);
                    }
                }
    
                Console.ReadKey();
            }
        }
    }
    

    7Zip Archive used has around 2 Gb

    Console output:

    text.txt with 88.13 KB

    video.mp4 with 1.96 GB

    promo.jpg with 56.98 KB

    On bin/debug files are extracted