JFrog Artifactory: Download Artifact using cURL

JFrog’s Artifactory is a binary repository manager.

The artifacts from Artifactory can be downloaded using REST API.

In this note i am showing how to download an artifact (simple file.zip) from generic Artifactory repository using curl command from the command line in Linux or from the PowerShell in Windows.

Cool Tip: Upload an Artifact to Artifactory using cURL! Read more →

Download Artifact from Artifactory using cURL

cURL in Linux

Download a file from generic Artifactory repository using the curl command in Linux.

Basic authentication using username and password or username and API Key:

$ curl -sSf -u "<USERNAME>:<PASSWORD>" \
       -O 'http(s)://<ARTIFACTORY_URL>/<REPO>/<PATH>/file.zip'

Authentication using API Key in HTTP header:

$ curl -sSf -H "X-JFrog-Art-Api:<API_KEY>" \
       -O 'http(s)://<ARTIFACTORY_URL>/<REPO>/<PATH>/file.zip'
Option Description
-s, --silent Don’t show progress meter or error messages
-S, --show-error When used with -s, --silent, it makes curl show an error message if it fails
-f, --fail Return an error if HTTP status code is not 200
-H, --header <header> Extra HTTP header to include in the request
-u, --user <username:password> Specify the username and password to use for server authentication
-O, --remote-name Write output to a local file named like the remote file we get

cURL in Windows PowerShell

Wget & cURL: The curl and wget commands in PowerShell are the aliases of the Invoke-WebRequest command.

Hide the progress of Invoke-WebRequest to increase download speed:

PS C:\> $progresspreference = 'silentlyContinue'

Download a file from generic Artifactory repository using Windows PowerShell (authentication using API Key in HTTP header):

PS C:\> curl -H @{'X-JFrog-Art-Api' = '<API_KEY>'} 'http(s)://<ARTIFACTORY_URL>/<REPO>/<PATH>/file.zip' -O 'C:\file.zip'
Option Description
-H, -Header Specify the headers of the web request
-O, -OutFile Specify the output file

Resume display of the progress bar:

PS C:\> $progressPreference = 'Continue'

Cool Tip: Download a file using PowerShell! Read more →

Was it useful? Share this post with the world!

2 Replies to “JFrog Artifactory: Download Artifact using cURL”

  1. curl command download corrupted file.

  2. The person who wrote this doesn’t understand that JFROG needs prefetched js libs… You will get a bad file anytime you use this method….

Leave a Reply