Code Monkey home page Code Monkey logo

github-files-fetcher's Introduction

Introduction License: MIT

The github-files-fetcher is designed for downloading parts of a github repository. This is very useful if you have a low bandwidth network or only need a particular file or subdirectory from a large repository. If you want to download a whole repository, prefer git clone.

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, which is usually enough. You can surpass this with authentication, using one of the following three ways:

  1. The --auth commandline option

    This option takes 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.

  2. Default configuration file

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

  3. Designate via --file commandline option

    For example, you can use ~/config.json as 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="~/" 

This is a template for the configuration file:

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

Behavior

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

github-files-fetcher requests resources without authentication by default to improve performance. However, this incurs a delay once the default unauthorized API access rate exceeded. To avoid this problem you can specify the --alwaysUseAuth option so github-files-fetcher always uses authentication.

Environment

node >= 6

Related works

There are some other good tools that function similarly:

github-files-fetcher's People

Contributors

gyumeijie avatar tdnguyen6 avatar xeruf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

github-files-fetcher's Issues

Repository url parsing error

The github-files-fetcher doesn't parse the url of a repository.

For example:
fetcher --url="https://github.com/reduxjs/redux/tree/master/examples/async/" --out="/tmp" is expected to generated the following output:

/tmp/async/README.md downloaded.
/tmp/async/package.json downloaded.
/tmp/async/.gitignore downloaded.
/tmp/async/src/index.js downloaded.
/tmp/async/package-lock.json downloaded.
/tmp/async/src/components/Posts.js downloaded.
/tmp/async/src/components/Picker.js downloaded.
/tmp/async/src/containers/App.js downloaded.
/tmp/async/src/reducers/index.js downloaded.
/tmp/async/public/index.html downloaded.
/tmp/async/src/actions/index.js downloaded.

But actually, it outputs the following messages, and the filenames are totally messed.

/tmp//EADME.md downloaded.
/tmp//rc/index.js downloaded.
/tmp//gitignore downloaded.
/tmp//ackage.json downloaded.
/tmp//rc/reducers/index.js downloaded.
/tmp//rc/containers/App.js downloaded.
/tmp//rc/components/Picker.js downloaded.
/tmp//rc/components/Posts.js downloaded.
/tmp//rc/actions/index.js downloaded.
/tmp//ublic/index.html downloaded.
/tmp//ackage-lock.json downloaded.

The url above should be treated as https://github.com/reduxjs/redux/tree/master/examples/async.

support fot gitlab

How can i use this for my gitlab repo,will a config change enable it or its not possible at the moment.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.