# async-dl-github-repo

> Asynchronously download a GitHub repo

Latest version **2.0.0** (published 2017-12-03) · GPL-3.0 license · 0 weekly downloads

## Install

```sh
npm install async-dl-github-repo
pnpm add async-dl-github-repo
yarn add async-dl-github-repo
bun add async-dl-github-repo
```

## Health

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

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2017-12-03 |
| First published | 2017-11-23 |
| Weekly downloads | 0 |
| License | GPL-3.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=8.0.0 |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Frangu Vlad |
| Maintainers | kingdgrizzle |
| Keywords | github, download, download-github, async-download |

## Links

- npm: https://www.npmjs.com/package/async-dl-github-repo
- Repository: https://github.com/KingDGrizzle/async-dl-github-repo
- Homepage: https://github.com/KingDGrizzle/async-dl-github-repo#readme
- Issues: https://github.com/KingDGrizzle/async-dl-github-repo/issues
- npm.io page: https://npm.io/package/async-dl-github-repo

## Dependencies (3)

- [yauzl](https://npm.io/package/yauzl.md) ^2.9.1
- [fs-nextra](https://npm.io/package/fs-nextra.md) ^0.3.2
- [snekfetch](https://npm.io/package/snekfetch.md) ^3.5.8

## Alternatives

- [@commercetools/sync-actions](https://npm.io/package/@commercetools/sync-actions.md) — 25.1K weekly downloads
- [cwait](https://npm.io/package/cwait.md) — 21.4K weekly downloads
- [@ledgerhq/hw-app-cosmos](https://npm.io/package/@ledgerhq/hw-app-cosmos.md) — 4.2K weekly downloads
- [@financial-times/o-loading](https://npm.io/package/@financial-times/o-loading.md) — 2.8K weekly downloads
- [fa](https://npm.io/package/fa.md) — 185 weekly downloads

## Recent versions

- 2.0.0 (latest) — 2017-12-03
- 1.0.1 — 2017-11-23
- 1.0.0 — 2017-11-23

## README

<div>
	<br />
	<p>
		<a href="https://www.npmjs.com/package/async-dl-github-repo"><img src="https://img.shields.io/npm/v/async-dl-github-repo.svg?maxAge=3600" alt="NPM version" /></a>
		<a href="https://www.npmjs.com/package/async-dl-github-repo"><img src="https://img.shields.io/npm/dt/async-dl-github-repo.svg?maxAge=3600" alt="NPM downloads" /></a>
		<a href="https://david-dm.org/KingDGrizzle/async-dl-github-repo"><img src="https://img.shields.io/david/KingDGrizzle/async-dl-github-repo.svg?maxAge=3600" alt="Dependencies" /></a>
	</p>
	<p>
    		<a href="https://nodei.co/npm/async-dl-github-repo/"><img src="https://nodei.co/npm/async-dl-github-repo.png?downloads=true&stars=true" alt="NPM info"></a>
  	</p>
</div>

# async-dl-github-repo
Asynchronously download a GitHub Repo

## Why should you use this module instead of [download-github-repo](https://www.npmjs.com/package/download-github-repo)

This package has size in mind, while also being adapted to the latest Node.js versions.
It is fully asyncronous, meaning you can download the repo, while doing other things. And, I've been inspired to make it because of `download-github-repo`

But heres a small list of what differs between async-dl-github-repo and download-github-repo:
- Size: `async-dl-github-repo` and its node\_modules folder takes up around \~356KB, while `download-github-repo` and its node_modules takes up \~5.56MB
- Dependency Count: `async-dl-github-repo` has in total 6 dependencies (7, counting itself), while `download-github-repo` has 96! (including itself)

If dependency count, size, or asyncronous is what you need more, use this. If not, feel free to use `download-github-repo`

## Installation

**Node.js 8.0 or newer is required**

To install this module, just run:
```
npm i async-dl-github-repo
```

## Usage and Examples

This module has one function, that is exported by default.

### download(repo, destination, downloadOnly = false)

Download a GitHub repo, `repo` should be in the format: `Username/ProjectName[#branch-name]`, where `#branch-name` is optional. (Don't include the brackets). By default, the branch is set to `master`.

`path` should be relative to the [process cwd](https://nodejs.org/api/process.html#process_process_cwd)

`downloadOnly` is optional, but you can make it just save the archive

Returns a Promise that resolves with the zip and final paths if the download was successful, or rejects if there were any errors.

Example:
```js
const dlRepo = require("async-dl-github-repo");

dlRepo("KingDGrizzle/async-dl-github-repo", "./temp").then(results => {
	console.log(`Downloaded successfuly at ${results.finalPath}`);
}).catch(err => {
	console.error(`Download errored: ${err}`);
});
```

Downloading just the archive:
```js
const dlRepo = require("async-dl-github-repo");

dlRepo("KingDGrizzle/async-dl-github-repo", "./temp", true).then(results => {
	console.log(`Downloaded at ${results.zipPath}`);
}).catch(err => {
	console.error(`Download errored: ${err}`);
});
```

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