Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8633231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:27:42+00:00 2026-06-12T09:27:42+00:00

I have a memory stream that contains a zip file in byte[] format. Is

  • 0

I have a memory stream that contains a zip file in byte[] format. Is there any way I can unzip this memory stream, without any need of writing the file to disk?

In general I am using ICSharpCode.SharpZipLib.Zip.FastZip to unzip a file, but is there any way to unzip a memory stream, maybe by storing the files in another MemoryStream or in byte[] format according to the files/folders present in the zip?

Any way I can use the Memorymapped files feature in this scenario ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T09:27:42+00:00Added an answer on June 12, 2026 at 9:27 am

    We use DotNetZip, and I can unzip the contents of a zip file from a Stream into memory. Here’s the sample code for extracting a specifically named file from a stream (LocalCatalogZip) and returning a stream to read that file, but it’d be easy to expand on it.

    private static MemoryStream UnZipCatalog()
    {
        MemoryStream data = new MemoryStream();
        using (ZipFile zip = ZipFile.Read(LocalCatalogZip))
        {
            zip["ListingExport.txt"].Extract(data);
        }
        data.Seek(0, SeekOrigin.Begin);
        return data;
    }
    

    It’s not the library you’re using now, but if you can change, you can get that functionality.


    Here’s a variation which would return a Dictionary<string,MemoryStream> of for the contents of every file of a zip file.

    private static Dictionary<string,MemoryStream> UnZipToMemory()
    {
        var result = new Dictionary<string,MemoryStream>();
        using (ZipFile zip = ZipFile.Read(LocalCatalogZip))
        {
            foreach (ZipEntry e in zip)
            {
                MemoryStream data = new MemoryStream();
                e.Extract(data);
                result.Add(e.FileName, data);
            }
        }
    
        return result;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a memory stream that contains a PDF file. Is it possible to
I have a WCF service that can return a stream via a WebGet. This
I have an xml file with a node that contains some c# code. <Script
trying to post a byte array or memory stream with RestSharp. I have tried
I have a method which returns some xml in a memory stream private MemoryStream
Two Windows processes have memory mapped the same shared file. If the file consists
I have a resource assembly that contains various strings, icons, and bitmaps that my
I have an word file that contain my specified pattern text {pattern} and I
I'm using the Amazon SDK and I have a method that returns a Stream
I have an array result that contains values from 0-255. I originally declared it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.