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

github-files-fetcher

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github-files-fetcher

download files from github repository

  • 1.6.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
303
decreased by-21.91%
Maintainers
1
Weekly downloads
 
Created
Source

Introduction License: MIT

The github-files-fetcher is mainly designed for downloading part file(s) from a github repository. This is very useful if you have a low bandwidth network and/or just need particular file(s) or subdirectory from a large repository. While you want to download the whole repository, the git clone command is preferred.

Installation

Run npm install -g github-files-fetcher

Basic usage

fetcher --url=resource_url  --out=output_directory

For example:

fetcher --url="https://github.com/Gyumeijie/github-files-fetcher/blob/master/CHANGELOG.md" --out=/tmp

Authentication

The default unauthorized API access rate is 60 times per hour, and usually this is enough. When the access rate exceeded, you can still achieve higher access rate by authentication, which can be done in the following three ways:

  1. The --auth commandline option

This option take the form of --auth=username:password, where the password can be either the login password for your github account or the personal access token which can be generated in https://github.com/settings/tokens.

  1. Default configuration file

The default configuration file is ~/.download_github, and the config file is a json file.

  1. Designate via --file commandline option

For example, you can have the ~/config.json be the configuration file.

 # download a directory
 fetcher --file="~/config.json" --url="https://github.com/reduxjs/redux/tree/master/examples/async" --out="~/" 
 
 # download a single file
 fetcher --file="~/config.json" --url="https://github.com/Gyumeijie/github-files-fetcher/blob/master/index.js" --out="~/" 

The following is the template of the configuration file:

{
   "auth": {
        "username" : "your_github_name",
        "password" : "password_or_api_access_token"
   },
   "alwaysUseAuth" : true,
   "timeout" : 5000 
}

When the default unauthorized API access rate exceeded, the github-files-fetcher will automatically switch to use authentication if one is provided through the three ways above.

Since the github-files-fetcher request resource without authentication in default for performance consideration, and switch to use authentication if necessary, this causes unnecessary cost once the default unauthorized API access rate exceeded. To avoid this problem you can have the github-files-fetcher always use authentication by specify --alwaysUseAuth option.

Environment

node >= 6

There are some other good tools that can do the same thing for you:

Keywords

FAQs

Package last updated on 12 May 2019

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