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. 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 "Push/Pull Packages" button:

1313

Select to Push/Pull a package

This will bring you to a window with a list of all supported package manager formats:

1313

Setup guides for native package managers

For example, If you select "Ruby" from the window, you are then presented with the guide on how to Pull or Push a ruby package in this repository. Go to the Pull Package tab to learn how to download a ruby package from this repository:

1303

Setup guide for Ruby packages

The instructions for downloading and installing a package using a native package manager are available by pressing the "Use Package" button on any package detail page:

1313

Setup Tab on Package Detail page

There you are presented with contextual instructions for how to use a package:

1313

Instructions for using a package


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 expose more button on the right of the page, or by clicking the green "Download" button on a package detail page:

1311

Download buttons on packages list (public repository)

1301

Download button on package detail page (public repository)


Private Repositories

Downloading packages from a private repository is a little different. Click the download button.

1344

Download buttons on repository packages list (private repository)

You will be prompted to enter an Entitlement token:

1344

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)
}

Cloudsmith is the new standard in Package / Artifact Management and Software Distribution

With support for all major package formats, you can trust us to manage your software supply chain.


Start My Free Trial Now
Cookie Declaration (Manage Cookies)