Replace curl with wget for compressed data

Viewed 1156

We are using curl and we want to change to wget.

The curl command is like following:

curl -fsSLO --compressed "https://yarnpkg.com/downloads/v1.22.4/yarn-v$1.22.4.tar.gz" && \ mkdir -p /opt  && \
tar -xzf yarn-v1.22.4 -C /opt/  

I've tried with wget:

wget -c "https://yarnpkg.com/downloads/v1.22.4/yarn-v$1.22.4.tar.gz"  

But not sure regard compressed to get the same effect exactly in wget.

1 Answers

wget has the --compression=type option:

--compression=type
       Choose the type of compression to be used.  Legal values are auto, gzip and none.

For both curl and wget compression option adds Accept-Encoding header to a request. curl adds Accept-Encoding: deflate, gzip, br and wget adds Accept-Encoding: gzip.

Related