'How to unzip Self Extracting Zip files in Azure Blob Storage?

I have a zip file(.Exe - Self-extracting zip file) that can be extracted using 7zip. As I want to automate the extraction process, I used the below C# code. It is working for the normal 7z files. But facing this issue 'Cannot access the closed Stream', when I trying to extract the specific self-extracting (.Exe) zip file. Fyi. Manually I ensured the 7zip command line version is unzipping the file.

using (SevenZipExtractor extract = new SevenZipExtractor(zipFileMemoryStream))
    {
        foreach (ArchiveFileInfo archiveFileInfo in extract.ArchiveFileData)
        {
            if (!archiveFileInfo.IsDirectory)
            {
                using (var memory = new MemoryStream())
                {
                    string shortFileName = Path.GetFileName(archiveFileInfo.FileName);
                    extract.ExtractFile(archiveFileInfo.Index, memory);
                    byte[] content = memory.ToArray();
                    file = new MemoryStream(content);
                }
            }
        }
    }

The zip file is in Azure blob storage. I dont know how to get the extracted files in the blob storage.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source