npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@terascope/fetch-github-release

v2.0.0

Published

Download a specific release from github

Downloads

7,958

Readme

Download Github Release

A node module to download Github release assets. It will also uncompress zip files and skip downloading if a file already exists.

$ fetch-github-release -s darwin-x64 electron electron
Downloading electron/[email protected]...
electron-v1.3.1-darwi... ▇▇▇▇▇---------------------------------------------------- 662.8s
electron-v1.3.1-darwi... ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇--------- 13.4s
electron-v1.3.1-darwi... ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇--- 3.6s
ffmpeg-v1.3.1-darwin-... ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 0.0s

This is useful for instance if you have a project that depends on binaries released via Github.

Command line

Installation

npm install -g @terascope/fetch-github-release
# or
yarn global add @terascope/fetch-github-release

Usage

Usage: fetch-github-release [options] <user> <repo> [outputdir]

Options:
  -V, --version          output the version number
  -p, --prerelease       download prerelease
  -s, --search <regexp>  filter assets name
  -q, --quiet            don't log to console
  -z, --zipped           don't extract zip files
  -h, --help             output usage information

Example

Download electron/electron assets whose name contains darwin-x64 to /tmp.

fetch-github-release -s darwin-x64 electron electron /tmp

If you need to download assets from a private repository or you need to avoid rate limits, you can set the environment variable GITHUB_TOKEN. To generate a token go to your Github settings and a token with public_repo or repo (for private repos) permissions.

API

Installation

npm install --save @terascope/fetch-github-release
# or
yarn add @terascope/fetch-github-release

Usage

import { downloadRelease }  from '@terascope/fetch-github-release';

const user = 'some user';
const repo = 'some repo';
const outputdir = 'some output directory';
const leaveZipped = false;
const disableLogging = false;

// Define a function to filter releases.
function filterRelease(release) {
  // Filter out prereleases.
  return release.prerelease === false;
}

// Define a function to filter assets.
function filterAsset(asset) {
  // Select assets that contain the string 'windows'.
  return asset.name.includes('windows');
}

downloadRelease(user, repo, outputdir, filterRelease, filterAsset, leaveZipped, disableLogging)
  .then(function() {
    console.log('All done!');
  })
  .catch(function(err) {
    console.error(err.message);
  });

downloadRelease returns an array of file paths to all of the files downloaded if called with leaveZipped = true.

TODO

  • other compression formats
  • option to download specific release instead of latest?
  • option to download source?