https://github.com/pspgbhu/github-download-parts
Not only download the whole repository from github, but also it is able to download a partial of repository!
https://github.com/pspgbhu/github-download-parts
download git git-clone git-clone-partial git-download git-download-partial git-partial
Last synced: 11 months ago
JSON representation
Not only download the whole repository from github, but also it is able to download a partial of repository!
- Host: GitHub
- URL: https://github.com/pspgbhu/github-download-parts
- Owner: pspgbhu
- Created: 2017-10-13T17:48:20.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-01-01T18:36:51.000Z (about 7 years ago)
- Last Synced: 2025-02-09T14:45:52.762Z (12 months ago)
- Topics: download, git, git-clone, git-clone-partial, git-download, git-download-partial, git-partial
- Language: JavaScript
- Homepage:
- Size: 120 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
English | [简体中文](./README_CN.md)
# github-download-parts
[](https://www.npmjs.org/package/github-download-parts)
[](https://npmjs.org/package/github-download-parts)
[](https://github.com/pspgbhu/github-download-parts/issues)
[](https://travis-ci.org/pspgbhu/github-download-parts)
It is able to download a partial of repository!
## Usage
- Download a single file
```js
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
```js
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
```js
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(git, target ,pathname)
- **git** ``
The git repository, the format of string is `"${username}/${repository}"`.
- **target** ``
The local folder path that files will be created into.
- **pathname** ``
A file or folder path of github repository.
### repo(options)
Or you could use a object as the `options` parameter
- **options** ``
- **username** ``: The username of github.
- **repository** ``: The name of the repository.
- **repo** ``: The shorthand for `username` and `repository`, the format is `"${username}/${respository}"`
- **target** ``: The local folder path that files will be created into.
- **pathname** ``: A file or folder path of github repository.
## CLI
### Install
```bash
# 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
```bash
$ repo -r "username/repository" -t local_folder -p target_file.js
```
- Download the whole repository
```bash
$ repo -r "username/repository" -t local_folder
```
### Options
- `-r --repo `: Github repository, the format is `"${username}/${repository}"`
- `-t --target `: The local directory that files will be created into
- `-p --pathname `: 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](https://developer.github.com/v3/#rate-limiting)