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
Why?
Hosting content on github is awesome! github-getter makes accessing those files easy (so you don't waste your precious time reading api docs!)
How?
Break down interaction with github into users, repos and files.
SETUP
-
import { GHFile, GHRepo, GHUser } from 'github-getter'
-
GHFile
Input a filepath and repo name to get and GHFile
object OR
-
GHRepo
: Input a repo name to get a GHFile
object for everything in the repo OR
-
GHUser
: Input a user/org name and get a GHRepo
object for each repository belonging to that user/org
USAGE
- navigate to
https://github.com/settings/tokens
- click this button to create new token
- create a file called
config.env
in your projects root - add the line
ghtoken=****************
to the file, adding you token. - run the command
npm i github-getter --save
- get coding!
import { gHUser, gHRepo } from 'github-getter.js';
gHUser('dwyl', true)({
getRepos: (err, repos) => {
repos.adoro({
getReadme: (err, readme) => readme({
getData: console.log
})
});
}
});
gHRepo('des-des/aibox')({
getFiles: (err, files) => {
files['.babelrc']({
getData: console.log
});
},
getReadme: (err, readme) => readme({
getData: console.log
})
});
see src/index.es6 for the example!