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

  • SEARCH
  • Home
  • 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 8262077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T03:38:28+00:00 2026-06-08T03:38:28+00:00

I am building a metro style app for windows 8 and I have a

  • 0

I am building a metro style app for windows 8 and I have a zip file that I am downloading from a web service, and I want to extract it.

I have seen the sample for compression and decompression, but that takes a single file an compresses/decompresses it. I have a whole directory structure that I need to extract.

Here is what I have so far:

var appData = ApplicationData.Current;
var file = await appData.LocalFolder.GetItemAsync("thezip.zip") as StorageFile;
var decompressedFile = await ApplicationData.Current.LocalFolder.CreateFileAsync("tempFileName", CreationCollisionOption.GenerateUniqueName);
using (var decompressor = new Decompressor(await file.OpenSequentialReadAsync()))
using (var decompressedOutput = await decompressedFile.OpenAsync(FileAccessMode.ReadWrite))
{
    var bytesDecompressed = await RandomAccessStream.CopyAsync(decompressor, decompressedOutput);
}

But this is no good, the bytesDecompressed variable is always zero size, but the zip File is 1.2MB

Any help here would be greatly appreciated.

EDIT: Answer, thanks to Mahantesh

Here is the code for unzipping a file:

private async void UnZipFile()
{
    var folder = ApplicationData.Current.LocalFolder;

    using (var zipStream = await folder.OpenStreamForReadAsync("thezip.zip"))
    {
        using (MemoryStream zipMemoryStream = new MemoryStream((int)zipStream.Length))
        {
            await zipStream.CopyToAsync(zipMemoryStream);

            using (var archive = new ZipArchive(zipMemoryStream, ZipArchiveMode.Read))
            {
                foreach (ZipArchiveEntry entry in archive.Entries)
                {
                    if (entry.Name != "")
                    {
                        using (Stream fileData = entry.Open())
                        {
                            StorageFile outputFile = await folder.CreateFileAsync(entry.Name, CreationCollisionOption.ReplaceExisting);
                            using (Stream outputFileStream = await outputFile.OpenStreamForWriteAsync())
                            {
                                await fileData.CopyToAsync(outputFileStream);
                                await outputFileStream.FlushAsync();
                            }
                        }
                    }
                }
            }
        }
    }
}
  • 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-08T03:38:30+00:00Added an answer on June 8, 2026 at 3:38 am

    In Metro style apps, you work with compressed files by using the methods in the ZipArchive, ZipArchiveEntry, DeflateStream, and GZipStream classes.

    Refer : UnZip File in Metro

    Refer : Folder zip/unzip in metro c#

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I decided to have a go at building Windows Metro style apps with the
I'm building a Windows 8 Metro app (aka Modern UI Style or Windows Store
I'm building a Windows 8 Metro app in HTML5/Javascript, and I have several screens
I'm building a Windows 8 Metro style app and I'd like to style the
I am trying to build a Windows 8 metro-style app that will operate as
I am in the process of building a metro style app and I need
I have a regular Windows API ( not metro ) application that I would
I'm building a Metro App using VS 2012 and the Windows 8 SDK. In
I am building a Metro Style App for Win8 which requires to pass two
I'm looking to build a Windows 8 Metro Style application (C# with XAML) that

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.