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

@shpiga/githubdownload

v1.6.1

Published

Easily download Github repos without any external dependencies such as Git, Tar, Unzip, etc.

Downloads

2

Readme


⚠️ THIS IS A FORK
This package is a fork of the public NPM github-download.
It was created to address security issues, fix bugs and add new functionality. While I'm not the author, I would be happy to resolve some issues and accept PR's.
All rights reserved by jprichardson and licensed under MIT.

Node.js - github-download

Easily download Github repos without any external dependencies such as Git, Tar, Unzip, etc.

Why?

I really like the concept of managing user defined projects, repos, file structures (package management) on Github like the way that Component does package management. I have a package management system Rock that I use to create skeleton/templates of projects. I wanted Rock to use Github as a package management system. I also didn't want any dependencies amongst any 3rd party programs like Git, Tar, or Unzip. Pure Node.js JavaScript is what I wanted.

Installation

npm install @shpiga/githubdownload

Usage

ghdownload(params, dir)

Downloads the latest copy of some Github reference (branch, tag, or commit), or the master branch by default (specifically the master branch, it does not honor Github's default branch configuration). This will still work even if the Github API limit has been reached.

  • params: Can either be:
    • a Github URL string such as:
      • https://github.com/jprichardson/node-vcsurl.git
      • [email protected]:jprichardson/node-vcsurl.git
      • git://github.com/jprichardson/node-vcsurl.git
      • and even including a reference, e.g. https://github.com/jprichardson/node-vcsurl.git#master
    • or an object like so: {user: 'jprichardson', repo: 'vcsurl', ref: 'master'}
  • dir: The output directory. Uses the current working directory if nothing is specified.

Returns a GithubDownloader object that emits events on dir, file, and end.

Example:

var ghdownload = require('@shpiga/githubdownload')
  , exec = require('exec')

ghdownload({user: 'jprichardson', repo: 'node-batchflow', ref: 'master'}, process.cwd())
.on('dir', function(dir) {
  console.log(dir)
})
.on('file', function(file) {
  console.log(file)
})
.on('zip', function(zipUrl) { //only emitted if Github API limit is reached and the zip file is downloaded
  console.log(zipUrl)
})
.on('error', function(err) {
  console.error(err)
})
.on('end', function() {
  exec('tree', function(err, stdout, sderr) {
    console.log(stdout)
  })
})

Outputs:

.
├── CHANGELOG.md
├── LICENSE
├── README.md
├── lib
│   └── batchflow.js
├── package.json
└── test
    ├── batchflow-par-array.test.js
    ├── batchflow-par-limit.test.js
    ├── batchflow-par-object.test.js
    ├── batchflow-seq-array.test.js
    ├── batchflow-seq-object.test.js
    ├── batchflow.test.js
    ├── mocha.opts
    └── resources

3 directories, 12 files

License

(MIT License)

Copyright 2013-2016, JP Richardson [email protected]