1.0.2 • Published 10 years ago
file-history v1.0.2
file-history
Returns an array of file contents based on git tags using the GitHub API.
Getting Started
npm i file-history
var history = require('file-history');
var config = {
repo: 'basscss/basscss',
filepaths: [
'/css/basscss.css',
'/basscss.css'
],
token: GITHUB_API_ACCESS_TOKEN
}
history(config, function(arr) {
// array of file objects
});
Configuration
repo
- theuser/repo
to get file contents from (must have git tags)filepaths
- an array of paths to check for the file. If the first one is not found, the next path in the array will be used.token
- GitHub API access token - Create a token here
DO NOT check in your access token to GitHub. Be sure to add that to your .gitignore
file.
Returned File Object
version
- Semver based on git tag (strips initialv
)filepath
- Relative path to file in the repocontent
- File content
MIT License