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

ghex

v0.0.27

Published

Github Extractor cli: List or download a whole repo or specific files and folders very quickly

Downloads

698

Readme

GHEX

Github Extractor CLI

List github repositories or download individual files or whole repos conveniently. Faster than clone depth=1 for an entire repo and much faster if you just need a single file

See an Asciinema video of usage (including with fzf) below.

Quickstart CLI

Install node then:

npx ghex -h

Or:

npm install -g ghex

Usage

ghex [options] <paths...>

Arguments

paths

One or more paths to download. Can be a whole repo, or a folder or a file within it. Supports globs but the path should be quoted. To exclude use a negative glob ("!" at the beginning). Can mix paths from different repos (conflicts resolved left to right). A trailing slash means a whole folder. Conflicting files are skipped by default.

Options

-l, --list

List files. Useful as a dry run and with fzf. Does not download. Will show show conflicts for the current working directory or -d / --dest.

-p, --prefix

Append the owner/repo prefix to the path in list output. This is useful for feeding back into ghex.

-c, --conflicts-only

Only show conflicts when listing.

-d, --dest (folder)

Destination folder. Defaults to the current directory.

-i, --case-insensitive

Ignores case when checking for conflicts. Default is case-sensitive--i.e. casing matters.

-f, --force

Overwrite all existing conflicting files. Default false.

-e, --echo-paths

After writing, outputs the path of each file plus a new line. Useful for piping to other commands. Also sets -quiet & --no-color.

-s, --strip (number)

Strip the first n directories from paths. If a path doesn't have enough directories to strip, it's skipped.

-q, --quiet

No success or error messages.

--no-prefix

Remove the owner/repo prefix from the path in list output

--no-colors

Strip ansi escape characters used to color output. ghex respects the NO_COLOR env var if set also.

Downloading Examples:

Entire repo:

npx ghex facebook/react

Specific folder:

npx ghex "facebook/react/packages/*"

Specify destination:

npx ghex -d local/dest facebook/react

Specific files

npx ghex facebook/react/.circleci/config.yml  facebook/react/.github/stale.yml

Different repos mixed together"

npx ghex facebook/react  micromatch/picomatch

Listing Examples:

Only conflicts

npx ghex -lc -d local/dest  facebook/react

Specific folder

npx ghex -l "facebook/react/.circleci/*"