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 🙏

© 2025 – Pkg Stats / Ryan Hefner

drfg

v0.0.4

Published

Download Release From GitHub, extract it into a new directory, and install dependencies, with a single command.

Readme

drfg - Download Release From GitHub

npm Build Status NPM version GitHub version

The idea of this package, is to make downloading / extracting / installing a GitHub repo's latest release a breeze (without creating a new repo, or using Git for that matter). Both in the terminal, and programmatically, if you are into that kind of thing...

npx drfg <github-username/repo>

This works for ALMOST any GitHub repo...

As long as the repository is using GitHub's releases feature, this script will work.

If a call to https://api.github.com/repos/{username/repo}/releases/latest returns a tag_name and zipball_url, then the script will download the zipball from zipball_url.

Additionally, if the repo contains a package.json after extraction, npm install will be run automatically, unless disabled. See advanced usage for more.

Table of Contents

Terminal Usage

Simple Usage

npx drfg <github-repo>

OR

npx drfg <github-repo> <new-folder-name>

For example, if you wanted to "clone" (download/extract/install) the repo sails-react-bootstrap-webpack, just do something like:

npx drfg neonexus/sails-react-bootstrap-webpack

This will download / extract / npm install the repo into a new folder sails-react-bootstrap-webpack. To change where the files get extracted to, add a second parameter to the command:

npx drfg neonexus/sails-react-bootstrap-webpack my-new-site

This will extract into my-new-site, instead of the repo name.

A Little More Advanced

If the repo contains a package.json in the root, but you don't want to npm install after extraction, just add no-npm:

npx drfg <github-repo> <no-npm?>

OR

npx drfg <github-repo> <new-folder> <no-npm?>

You can also provide a specific version to download / extract:

npx drfg <github-repo> <new-folder> <version?> <no-npm?>

NOTE: When supplying a version, you MUST supply a folder name.

This will download v4.2.3, into the folder new-site, and will skip the npm install step:

npx drfg neonexus/sails-react-bootstrap-webpack new-site v4.2.3 no-npm

Installing drfg Globally

npm i -g drfg

You can install drfg globally and run it directly (if you have your $PATH set correctly). This will save a small amount of time, as npx won't have to download and install, before running drfg. However, this also means you won't always be using the most up-to-date version of drfg (GitHub may change their API, security issues may arise, etc.).

To help ensure you are always up-to-date, drfg will use itself to check if there is an update, and if your current version doesn't match the latest version on GitHub, it will let you know. This does not prevent you from using the version you already have installed, but it will ask you if you want to continue (you can simply hit enter).

Example Update

Additional Script Names

Once installed globally, you can use drfg directly, with one of its few different binary names:

  • drfg
  • dl-rl-from-gh
  • download-rl-from-gh
  • download-rl-from-github
  • download-release-from-gh
  • download-release-from-github

Programmatic Usage

Using .then():

const drfg = require('drfg');

drfg.downloadAndExtract('username/my-repo', 'new-folder').then(
    (downloadInfo) => {}
);

// OR

drfg.downloadAndExtract({
    repo: 'username/my-repo',
    destinationFolder: 'my-clone'
}).then((downloadInfo) => {});

Using await:

const drfg = require('drfg');

const downloadInfo = await drfg.downloadAndExtract(
    'username/my-repo',
    'new-folder'
);

// OR

const downloadInfo = await drfg.downloadAndExtract({
    repo: 'username/my-repo',
    destinationFolder: 'my-clone'
});

downloadInfo will look something like:

{
    version: 'v1.0.1',
    downloadTime: '714.82 ms',
    extractionTime: '55.17 ms',
    installationTime: '2.75 s',
    totalTime: '3.61 s',
    zipballSize: '45.11 KiB',
    extractedSize: '146.73 KiB',
    installedSize: '19.45 MiB'
}

Advanced usage

const drfg = require('drfg');

// Parameters are: destination-folder, repo, version, skipNpmInstall
const downloadInfo = await drfg.downloadAndExtract(
    'username/my-repo',
    'new-folder',
    'v1.0.1',
    true
);

// OR
const downloadInfo = await drfg.downloadAndExtract({
    repo: 'username/my-repo',
    version: 'v1.0.1',
    skipInstall: true,
    destinationFolder: 'my-clone'
});

Getting Version Info for a Repo

const drfg = require('drfg');

const latestVersionInfo = await drfg.getVersionInfo('username/my-repo');

// OR

drfg.getVersionInfo('username/my-repo').then((latestVersionInfo) => {
    // Do stuff with the info...
});

latestVersionInfo will look something like:

{
    name: 'v1.0.1 (2023-10-01)',
    description: 'The version description body. This will likely contain markdown.',
    version: 'v1.0.1',
    isDraft: false,
    isPrerelease: false,
    createdAt: '2023-10-01T04:19:00Z',
    publishedAt: '2023-10-01T04:19:00Z',

    // `userSite` is the HTML URL for human use:
    userSite: 'https://github.com/{username/repo}/releases/tag/v1.0.1',

    // `zipball` is the URL drfg will use internally to download the repo:
    zipball: 'https://api.github.com/repos/{username/repo}/zipball/v1.0.1'
}

Get info for a specific version:

const drfg = require('drfg');

const latestVersionInfo = await drfg.getVersionInfo(
    'username/my-repo',
    'v1.0.1'
);

Don't Forget to Handle Errors...

const drfg = require('drfg');

drfg.downloadAndExtract('username/my-repo', 'new-folder')
    .then((successMessage) => {})
    .catch((e) => {});

drfg.getVersionInfo('username/my-repo')
    .then((latestVersionInfo) => {})
    .catch((e) => {});

// OR

try {
    const downloadInfo = await drfg.downloadAndExtract(
        'username/my-repo',
        'new-folder'
    );
} catch (e) {
    // Display the error...
}

try {
    const latestVersionInfo = await drfg.getVersionInfo(
        'username/my-repo'
    );
} catch (e) {
    // Display the error...
}