file-system-github

1.1.5 • Public • Published

file-system-github

Build Status

File-system synchronization with a remote repository on Github.

Usage

Create a repository connector:

const GITHUB_TOKEN = process.env.GITHUB_TOKEN // See: https://github.com/settings/tokens
const repo = github.repo(
  "my-user-agent",
  "philcockfield/app-sync",
  { token: GITHUB_TOKEN }
);

Get and save a single file on the master branch:

repo.get("/README.md")
  .then(result => {
    // File(s) returned as in-memory array.
    // Save the files to disk by using the save method:    
    return result.save("/path/to/save/to");
  });
 

Get and save an entire repository on the devel branch:

 
repo.get("/", { branch: "devel" })
  .then(result => {
    return result.save("/path/to/save/to");
  });
 
 

Test

# Run tests.
npm test

# Watch and re-run tests.
npm run tdd

License: MIT

Readme

Keywords

Package Sidebar

Install

npm i file-system-github

Weekly Downloads

2

Version

1.1.5

License

MIT

Last publish

Collaborators

  • philcockfield