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-repo-dir

v1.0.7

Published

A github repository folder download package

Downloads

9

Readme

Description

NPM version

I want to find a libray that can download folder in the github repository, but I can't find, so, I only write by myself.

Usage

  const create = require('get-repo-dir')

  const options = {
    destPath: './dist',
    dirPath: 'packages',
    repo: 'https://github.com/facebook/react.git',
  }

  // Clear old files before every download
  create(options).remove().download()

Options

  • repo - The github repesitory url that needs to be downloaded.
  • dirPath - The folder url of need download, the root path is current repository.
  • destPath - Download the file storage path.
  • branch - Repository branch,default is master.
  • needSize - You whether need to detect the size of the file package, let the download progress bar use, default is false.
  • timeout - Specify the timeout period, timeout will exit the process, The unit is s, default is 5 * 60s.
  • hooks - The hooks of the download process, the this in the hooks function points to the currently created instance, the default hooks is defined in here.

API

remove(url?: string)

Example: D.remove()

The remove method will deletes the specified folder, and if the url is not passed, deletes the folder where the download file path is stored by default.

download()

Example: D.download()

The download will download specify files

Tips

  • For the options.needSize item, if you download a small number of large files, you can set it to true so that the progress bar is displayed according to the file package size for a better download experience. If you are downloading a large number of small files, it is recommended to set false, don't waste time because of too many requests.

  • This package will detect the html string of the folder page and get the file to be downloaded. Therefore, the more folders, the more it affects the download speed. If you need to download the full repository, it is recommended to use the download-git-repo package.

  • If the downloaded file is particularly large, options.timeout may need to be reset to a longer time.

Cli

npm i get-repo-dir -g
repo download [options] [repoURL]

Supported options:

  • -d, --dirpath - Same as options.dirPath, default is /.
  • -l, --local - Same as options.destPath, default is process.cwd().
  • -b, --branch - Same as options.branch, default is master.
  • -s, --needsize - Same as options.needSize, default is false.
  • -t, --timeout - Same as options.timeout, default is 5 * 60s.

demo

  repo download https://github.com/vuejs/vue.git -d ./src -l ./vue