Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github-download-parts

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github-download-parts

Download a partial folder of your Github repository.

  • 2.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
41
increased by5.13%
Maintainers
1
Weekly downloads
 
Created
Source

English | 简体中文

github-download-parts

npm package NPM downloads GitHub issues Build Status

It is able to download a partial of repository!

Usage

  • Download a single file
const repo = require('github-download-parts');

// download the `index.js` file to `target` folder
repo('pspgbhu/github-download-parts', 'target', 'index.js')
  .then(() => {
    console.log('download success');
  })
  .catch(() => {
    console.log('download error');
  }
  • Download a folder
const repo = require('github-download-parts');

// download all files in the `test` folder of github repository to the local `target` folder.
repo('pspgbhu/github-download-parts', 'target', 'test')
  .then(() => {
    console.log('download success');
  })
  .catch(() => {
    console.log('download error');
  });
  • Download a whole repository
const repo = require('github-download-parts');

// download the whole repository into target local folder
repo('pspgbhu/github-download-parts', 'target')
  .then(() => {
    console.log('download success');
  })
  .catch(() => {
    console.log('download error');
  });

API

repo(options [, target ,pathname])

  • options <string>

    Could input a string as the options, the format is "${username}/${repository}".

  • target <string>

    The local folder path that files will be created into.

  • pathname <string>

    A file or folder path of github repository.

Or you could use a object as the options parameter

  • options <object>
    • username <string>: The username of github.
    • repository <string>: The name of the repository.
    • repo <string>: The shorthand for username and repository, the format is "${username}/${respository}"
    • target <string>: The local folder path that files will be created into.
    • pathname <string>: A file or folder path of github repository.

CLI

Install

# Install the package
$ npm i -g github-download-parts

# Show more information about github-download-parts cli
$ repo -h

Example

  • Download a file or folder form someone github repository
$ repo -r "username/repository" -t local_folder -p target_file.js
  • Download the whole repository
$ repo -r "username/repository" -t local_folder

Options

  • -r --repo <repo>: Github repository, the format is "${username}/${repository}"

  • -t --target <dir>: The local directory that files will be created into

  • -p --pathname <path>: The file or folder path of github repository you want to download

Download Limiting

Because of Github API Rate Limiting, every IP only be allowed 60 requests per hour, So every IP just only could download 60 times per hour.

Know More About Github Rate Limiting

FAQs

Package last updated on 18 Sep 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc