# get-github-code

> Downloads a GitHub project source code (only the code, without the .git data)

Latest version **1.0.4** (published 2021-04-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install get-github-code
pnpm add get-github-code
yarn add get-github-code
bun add get-github-code
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2021-04-06 |
| First published | 2020-10-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >= 10.0.0 |
| Dependencies | 3 |
| Unpacked size | 57.6 KB |
| Known vulnerabilities | 0 (+27 in 2 direct dependencies) |
| Install scripts | no |
| Author | Diego Zanon |
| Maintainers | zanon.dev |
| Keywords | download, github, repo, repository, source code, zip |

## Links

- npm: https://www.npmjs.com/package/get-github-code
- Repository: https://github.com/diegozanon/get-github-code
- Homepage: https://github.com/diegozanon/get-github-code#readme
- Issues: https://github.com/diegozanon/get-github-code/issues
- npm.io page: https://npm.io/package/get-github-code

## Dependencies (3)

- [axios](https://npm.io/package/axios.md) ^0.21.1
- [decompress](https://npm.io/package/decompress.md) ^4.2.1
- [@types/decompress](https://npm.io/package/@types/decompress.md) ^4.2.3

## Alternatives

- [lodash.startswith](https://npm.io/package/lodash.startswith.md) — 769.7K weekly downloads
- [@tarojs/service](https://npm.io/package/@tarojs/service.md) — 33.9K weekly downloads
- [io.extendreality.tilia.indicators.spatialtargets.unity](https://npm.io/package/io.extendreality.tilia.indicators.spatialtargets.unity.md) — 131 weekly downloads
- [@rtarojs/taro](https://npm.io/package/@rtarojs/taro.md) — 90 weekly downloads
- [node-branch-io](https://npm.io/package/node-branch-io.md) — 50 weekly downloads

## Recent versions

- 1.0.4 (latest) — 2021-04-06
- 1.0.3 — 2020-10-26
- 1.0.2 — 2020-10-22
- 1.0.1 — 2020-10-18
- 1.0.0 — 2020-10-17
- 1.0.0-rc2 — 2020-10-17
- 1.0.0-rc1 — 2020-10-17

## README

# get-github-code
Downloads a GitHub project source code, but only the code without the .git data.

## Install  

```
$ npm install get-github-code
```

**Note**: it requires Node.js 10.x or greater.

## Usage  

Example using CommonJS:

```javascript
const getGithubCode = require('get-github-code');

const url = 'https://github.com/diegozanon/get-github-code';

getGithubCode(url)
    .then(() => {
        console.log('success');
    })
    .catch(console.error);
```

Example using ES Modules:

```javascript
import { download } = from 'get-github-code';

const downloadMyRepo = async () => {
    const url = 'https://github.com/diegozanon/get-github-code';

    await download(url);
}
```

## API  

### download(url, [options])

or

### download(options) 

Both of them return `Promise<void>`

#### url  

In the format: `https://github.com/<username>/<repo>#<branch or tag>`

If there is no `#<branch>` or `#<tag>` at the end, the request will use the repository default branch.

#### options  

If you are using TypeScript: 

```javascript
import { download, DownloadOptions } from 'get-github-code';

const options: DownloadOptions = {
    username: 'the-username',
    repo: 'the-repository',
    branch: 'the-branch-or-tag',
    output: './my-folder', // default is the current repository, under the 'repo-branch' folder name
    zip: false // default is false
}
```

**Note**: all options are optional. If a `url` is given, the `username`, `repo` and `branch` will be ignored.

CommonJS:

```javascript
const getGithubCode = require('get-github-code');

const options = {
    username: 'the-username',
    repo: 'the-repository',
    branch: 'the-branch-or-tag',
    output: './my-folder', // default is the current repository, under the 'repo-branch' folder name
    zip: false // default is false
}
```

## License

MIT

---
_Source: https://npm.io/package/get-github-code · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
