Package Download
We offer two methods to download a package:
- via a native package manager
- via the Website UI
We don't currently offer the ability to download a package directly using the API / CLI (it's on the plans though!)
However, you can use the API to obtain a URL that you can then use to download a package.
See the full API documentation, including an interactive sandbox environment for you to test your API requests.
Download via Native Package Manager
Each repository contains context-aware documentation for setting up and downloading packages using the native package managers (such as apt
, npm
or gem
for example). Click the arrow beside "Set me up" to get a drop-down list of available setup instructions for the package managers used by any of the packages in your repository:

Setup guides for native package managers
For example, If you select "Ruby" from the drop-down list, you are then presented with the guide to set up this repository as a source for ruby packages:

Setup guide for Ruby packages
The instructions for downloading and installing a package using a native package manager are available in the "Setup" tab on any package detail page:

Setup Tab on Package Detail page
Download via Website UI
You can download a package directly from the Cloudsmith Website.
Public Repositories
You can download any package from the packages list by clicking the green button on the right of the page, or by clicking the green "Download" button on a package detail page:

Download buttons on packages list (public repository)

Download button on package detail page (public repository)
Private Repositories
Downloading packages from a private repository is a little different. If you click the green download button, you will download the package using the default entitlement token. If you click the green arrow beside the download button, you will be offered the choice of which entitlement token (or other credentials such as email/password) to use for the download:

Download buttons on repository packages list (private repository)
See Entitlements and Sharing a Private Package for more details on Entitlement Tokens.
Bulk Package Download
While we currently do not offer this functionality from the Website UI, it can be achieved with a little scripting using the Cloudsmith CLI. The Cloudsmith CLI is Python-based, so it needs Python (2 or 3) installed, and is available via pip
(pip install cloudsmith-cli
).
The basic premise of these examples is that you use the Cloudsmith CLI to list the contents of the repository, extract the download URL for each package and then download each package:
Linux Example (bash)
Please ensure that you have first set up the Cloudsmith CLI with your API key (or pass it to the cloudsmith
command using the -k
flag). See the CLI documentation for full details: Command-Line Interface
account="your-account"
repository="your-repo"
urls=$(cloudsmith ls pkgs $account/$repository -F json | jq -r '.data[].cdn_url')
for url in $urls; do
wget $url
done
account="your-account"
repository="your-repo"
token="your-entitlement-token"
urls=$(cloudsmith ls pkgs $account/$repository -F json | jq -r '.data[].cdn_url')
for url in $urls; do
wget --http-user=$account --http-password=$token $url
done
These examples also use jq
for filtering and processing the JSON returned by Cloudsmith CLI list packages (cloudsmith ls
) command.
You can also add search queries to the command to limit what is downloaded, e.g:
To download files of version 1.0 only:
urls=$(cloudsmith ls pkgs $account/$repository -F json -q 'version:1.0' | jq -r '.data[].cdn_url')
To download npm packages only:
urls=$(cloudsmith ls pkgs $account/$repository -F json -q 'format:npm' | jq -r '.data[].cdn_url')
Windows Example (Powershell 3.0)
Please ensure that you have added the Python scripts directory your PATH (when you install via pip
it will tell you what the path is) and also that you've got your API key from https://cloudsmith.io/user/settings/api/ if the repository is private
$account = "your-account"
$repository = "your-repository"
$key = "your-API-key"
$json = $(cloudsmith.exe ls pkgs $account/$repository -F json -k $key)
$urls = $json | ConvertFrom-Json | ForEach-Object { $_.data.cdn_url }
$wc = New-Object System.Net.WebClient
$creds = new-object System.Net.NetworkCredential("token", $key)
Foreach ($url in $urls) {
echo "Downloading $url ..."
$filename = [System.IO.Path]::GetFileName($url)
$cred_cache = new-object System.Net.CredentialCache
$cred_cache.Add($url, "Basic", $creds)
$wc.Credentials = $cred_cache
$wc.DownloadFile($url, $filename)
}
Updated over 1 year ago