file-history
v1.0.2
Published
Use GitHub API to get a file's history for each git tag
Downloads
9
Readme
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