Miss any of our Open RFC calls?Watch the recordings here! »

sync-github-to-fs

2.1.0 • Public • Published

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 API wrapper module. (Last tested with 9.x.x)

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:

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)
})

Keywords

Install

npm i sync-github-to-fs

DownloadsWeekly Downloads

11

Version

2.1.0

License

WTFPL

Last publish

Collaborators

  • avatar