github-getter
v3.1.0
Published
Quick and easy github file retrieval
Downloads
7
Readme
webhooks coming soon (so you gh hosted content can tell you site when to update!)
github-getter
What?
A quick and easy way to get files from github
github-getter is a small module to take the hassle out of downloading files from github. Download specific files, or specify repositories/users and recieve lists of files/repositories available.
Why?
Save time digging around docs / fiddling with with headers.
How?
get a github api token. Create a personal one here or use oauth.
node 6
const { user, repo, file } = require('./src/')(process.env.ghtoken)
const logContent = (err, res) => {
if (err) throw err
console.log(res.content)
}
file({ repoName: 'des-des/github-getter', filePath: 'README.md' }, logContent)
repo({ repoName: 'des-des/github-getter' }, (err, githubGetter) => {
if (err) throw err
githubGetter['README.md'](logContent)
})
user({ name: 'des-des' }, (err, desdes) => {
if (err) throw err
desdes['github-getter']((err, githubGetter) => {
if (err) throw err
githubGetter['README.md'](logContent)
})
})
Documentation
init
-token => githubGetter
, wheretoken
- github api token.
githubGetter
- object withfile
-({ repoName, filePath }, cb) => {}
, whererepoName
- name of the repository,filePath
- path of desired file, ieassets/someData.json
,cb
-(err, githubFile) => {}
.
repo
-({ repoName }, cb) => {}
, whererepoName
- name of the repository,cb
-(err, githubRepo) => {}
.
user
-({ name }, cb) => {}
, wherename
- github user name,cb
-(err, githubUser) => {}
.
org
-({ name }, cb) => {}
, wherename
- github org name,cb
-(err, githubUser) => {}
.
githubFile
- object containingcontent
- string containing file content
- githubRepo - an object were keys are paths to repos files:
[filepath]
-cb(err, githubFile) => {}
.
- githubUser - an object were keys are repo names belonging to the user/org:
[repoName]
-cb(err, githubRepo) => {}
.