# sync-github-to-fs

> Keep a local folder up to date with the contents of a Github repository

Latest version **2.1.0** (published 2017-08-05) · WTFPL license · 0 weekly downloads

## Install

```sh
npm install sync-github-to-fs
pnpm add sync-github-to-fs
yarn add sync-github-to-fs
bun add sync-github-to-fs
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.0 |
| Published | 2017-08-05 |
| First published | 2015-01-14 |
| Weekly downloads | 0 |
| License | WTFPL |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | TehShrike |
| Maintainers | tehshrike |
| Keywords | github, fs |

## Links

- npm: https://www.npmjs.com/package/sync-github-to-fs
- Repository: https://github.com/TehShrike/sync-github-to-fs
- Issues: https://github.com/TehShrike/sync-github-to-fs/issues
- npm.io page: https://npm.io/package/sync-github-to-fs

## Dependencies (4)

- [mkdirp](https://npm.io/package/mkdirp.md) ^0.5.0
- [p-queue](https://npm.io/package/p-queue.md) 0.2.0
- [then-nodeify](https://npm.io/package/then-nodeify.md) 1.0.1
- [then-denodeify](https://npm.io/package/then-denodeify.md) 1.0.0

## Alternatives

- [unionfs](https://npm.io/package/unionfs.md) — 2.2M weekly downloads
- [path-starts-with](https://npm.io/package/path-starts-with.md) — 35.9K weekly downloads
- [redzip](https://npm.io/package/redzip.md) — 1.2K weekly downloads
- [vscode-anymatch](https://npm.io/package/vscode-anymatch.md) — 848 weekly downloads
- [@ledgerhq/coin-filecoin](https://npm.io/package/@ledgerhq/coin-filecoin.md) — 793 weekly downloads

## Recent versions

- 2.1.0 (latest) — 2017-08-05
- 2.0.0 — 2016-12-29
- 1.1.1 — 2015-06-09
- 1.1.0 — 2015-06-09
- 1.0.0 — 2015-01-14

## README

Syncs a branch of a repository to a local directory.

Uses the Github API.  Doesn't create any local git metadata.

Deletes all files in the local directory that do not exist in the repo.

Calculates the hash of the local files and only downloads files from the repository that have different hashes than the local files.

# Usage

First install, require, initialize, and if you need to, authenticate this [github](https://www.npmjs.com/package/github) API wrapper module.  (Last tested with 9.x.x)

```js
const GitHubApi = require('github')

const github = new GitHubApi({
	timeout: 5000,
	headers: {
		'user-agent': 'sync-github-to-fs',
	}
})
```

Then, install and require this module, and do this stuff:

```js
const sync = require('sync-github-to-fs')

const repoDetails = {
	user: 'TehShrike',
	repo: 'sync-github-to-fs',
	ref: 'heads/master',
	simultaneousRequests: 3 // defaults to 5
}

sync(github, repoDetails, '/some/local/directory', function(err, res) {
	console.log('some strings saying stuff that happened', res)
})
```

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