Why Wget Change File Type?

Why Wget Change File Type?

I am downloading a tar.gz file using this command:

wget -c 

When download complete,check file type:

file example.tar.gz

The output is:HTML document text.Unpack file:

tar -zxvf example.tar.gz

The output:

gzip: example.tar.gz: not in gzip format

Why would this happen?What should I do to make it right?I am absolutely sure it is a tar.gz file because change other way to download,and unpack successful.This command make it works:

curl -O 
2

2 Answers

wget doesn't change the file type but what you got as a response for your request was not what you expected. You expected a tar archive but got an HTML file. wget just stores what it got under the name you specified.

Have a look at the contents of HTML file you got. It probably tells you what error has happened (that's the typical case why you get an HTML file instead of what you expected).

wget doesn't change the file format. , despite what it's name may suggest, isn't a tar.gz archive, but just a plain old HTML page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Sarah Jenkins
Author

Sarah Jenkins

Sarah Jenkins is a veteran tech journalist with over 12 years of experience covering artificial intelligence, mobile innovations, and digital ethics. Her insights have appeared in leading technology publications worldwide.