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

get-git-release

v1.0.2

Published

A helper module for downloading GitHub releases.

Downloads

3

Readme

Overview

A simple Node module that allows a user to get metadata about or download the latest release, or specific releases using an id or tag. It exposes the option to get either the zipball or the tarball, or both.

Importing

Install get-git-release with the following:

npm install get-git-release

Require the module:

const rel = require('get-git-release');

Usage

Each method requires a params object which contains metadata like the user of the repo, the repo name itself and specific release options.

Get Release JSON

const params = {
  user: 'facebook',
  repo: 'react',
  tag: 'v15.5.0'
}

rel.getReleaseByTag(params, function(error, response) {
  if(!error && response.statusCode == 200)
    console.log(response.body);
});

rel.getLatestRelease(params, function(error, response) {
  if(!error && response.statusCode == 200)
    console.log(response.body);
});

There is also a rel.getReleases() method which follows the same syntax but gets all releases and a rel.getSingleRelease() which gets a release by id. To grab a release by id though, you must add an id field to the params object.

Downloading Releases

const params = {
  user: 'facebook',
  repo: 'react',
  saveDirectory: 'Downloads/ReactReleases/',
  zipball: {
    fileName: 'react.zip'
  }
}

rel.downloadReleaseByTag(params, function(error, response) {
  console.log(response); // download has finished from the URL
});

You can download just the tarball or both the zipball and tarball by adding a tarball property to the params object. Other download methods:

rel.downloadLatestRelease(params, callback);
rel.downloadSingleRelease(params, callback);

Notes

  • If a release is not found given the supplied params, the response will return a 404 with a Not Found message.

Roadmap

  • Download private repositories
  • Download all releases
  • Maintain remote filename
  • Unzip option