Skip to content

fazouane-marouane/github-release-downloader

Repository files navigation

github-release-downloader

npm version Build status CircleCI license

Installation

Installing the cli tool is as easy as this:

npm install -g github-release-downloader

Simple usage

For example, to download all node-sass's binaries:

grd --token <your github api token> --owner sass --repository node-sass

To download all node-sass's binaries for versions above v4.0.0 you would do

grd --token <your github api token> --owner sass --repository node-sass --min-version v4.0.0

PS: to get a personal api token you'll need to generate one. No special right is required.

Advanced usages

1. Custom download path

By default the download path is the path from where you ran node. But it's easy to override this with the the option --output (or -o if you feel that life is too short).

grd --token <your github api token> --owner sass --repository node-sass --output local-cache

2. Parallel download

By default downloads are launched in parrallel; 3 downloads at a time. You can ofcourse specify a more appropriate number if you like:

grd --token <your github api token> --owner sass --repository node-sass --parallel 10

3. Filter assets

By default you get all assets available. No filter is applied. Let's imagine that you're only interested in linux & windows binaries. You would use --filter-asset.

grd --token <your github api token> --owner sass --repository node-sass --filter-asset '^(win32-ia32|win32-x64|linux-ia32|linux-x64)'

4. Filter versions

You have two possibilities here:

--min-version and you'd download all versions starting from the argument (this respects semver).

grd --token <your github api token> --owner sass --repository node-sass --min-version "v4.0.0"

or you can use --match-version and pass a regexp. Here are some examples

# Download only the version v4.0.0
grd --token <your github api token> --owner sass --repository node-sass --match-version "^v4\.0\.0$"

# Download only all versions v4.0.x v4.1.x v4.2.x
grd --token <your github api token> --owner sass --repository node-sass --match-version "^v4\.(0|1|2)\."

# Download all win23-x64 assets of all alpha versions since v1
grd --token <your github api token> --owner sass --repository node-sass --min-version "v1.0.0-alpha" --match-version "alpha" --filter-asset "^win32-x64"

5. Using a HTTP/HTTPS proxy

If you're behind a http/https proxy, you can also use it with grd with those parameters:

# Use the defaut proxy ($http_proxy or $https_proxy)
grd --token <your github api token> --owner sass --repository node-sass --proxy

# Use an explicit proxy
grd --token <your github api token> --owner sass --repository node-sass --proxy "https://username:password@proxy:port/"

Other types of proxies are not supported.

6. Ignore missing assets

Sometimes, GitHub releases may reference assets that are no longer available. Maybe the asset has since been deleted, but GitHub's api still references it. By default, since v1.2.0, if we the asset that we try to download is missing a warning is logged and we carry on with the other tasks. You can override this behavior if you'd prefer to raise a fatal error and stop the process by passing --no-ignore-missing-assets.

#
grd --token <your github api token> --owner sass --repository node-sass --match-version "^v4.6.1" --filter-asset "win32-ia32-45_binding.pdb" --no-ignore-missing-assets