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 8158681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T17:41:12+00:00 2026-06-06T17:41:12+00:00

Hello everyone I am getting this exception: The magic number in GZip header is

  • 0

Hello everyone I am getting this exception:

The magic number in GZip header is not correct. Make sure you are passing in a GZip stream.

All I have done is decompress the file into a GZip and then pass that into a stream, to pass that into a file.

using (FileStream fInStream = new FileStream(@"C:\Users\UNI\Desktop\FrostbyteDBUpdateProgram\FrostbyteDBUpdateProgram\bin\Debug\" + fileName, FileMode.Open, FileAccess.Read))
        {
            using (GZipStream gZip = new GZipStream(fInStream, CompressionMode.Decompress))
            {
                using (FileStream fOutStream = new FileStream(@"C:\Users\UNI\Desktop\FrostbyteDBUpdateProgram\FrostbyteDBUpdateProgram\bin\Debug\test1.docx", FileMode.Create, FileAccess.Write))
                {
                    byte[] tempBytes = new byte[4096];
                    int i;
                    while ((i = gZip.Read(tempBytes, 0, tempBytes.Length)) != 0)
                    {
                        fOutStream.Write(tempBytes, 0, i);
                    }
                }
                gZip.Close();
            }
            fInStream.Close();
        }
  • 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-06T17:41:14+00:00Added an answer on June 6, 2026 at 5:41 pm

    The GZipStream class is not suitable to read compressed archives in the .gz or .zip format. It only knows how to de/compress data, it doesn’t know anything about the archive file structure. Which can contain multiple files, note how the class doesn’t have any way to select the specific file in the archive you want to decompress.

    Zip archive support will be added in .NET 4.5. Until then you could use the popular SharpZipLib or DotNetZip libraries. Google their name to find the download.

    If the file you want to decompress was actually generated by GZipStream then there’s a bug in the code that did that, we can’t see it.

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

Sidebar

Related Questions

Hello everyone don't know why this code works on windows but not on linux
Hello everyone I am trying to resize an image of 700kb with imagecreatefromjpeg. This
Hello everyone i am trying to format the input number range with php number_format
hello everyone im trying to create this tweak that copies a file from one
Hello everyone this is my first post on stack overflow.com I am trying to
Hello everyone I am trying to make since of what I am doing wrong
Hello Everyone I am new being in ANDROID so I am getting one problem
Hello everyone it's been some days that I use sql to make analysis and
Hello everyone and thanks for helping me. I made this calculator in C# and
Hello everyone I have a question... I'm trying to make my sms faker app,

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.