Collect all the image file URLs in a GitHub repository
npm install repo-images --save
const repoImages = require('repo-images')
repoImages('user/repo').then(images => {
// an array of image objects
})
Each object in the returned array has this structure:
{
path: 'build/icon.icns',
mode: '100644',
type: 'blob',
sha: '3e7e2a36f9d1a5dfcaae886d0c0e5043b3ffee6a',
size: 1192844,
url: 'https://api.github.com/repos/ummoji/ummoji-desktop/git/blobs/3e7e2a36f9d1a5dfcaae886d0c0e5043b3ffee6a',
rawgit: 'https://cdn.rawgit.com/ummoji/ummoji-desktop/master/build/icon.icns'
}
The default branch is master
, but you can override it:
repoImages('user/repo', {branch: 'not-master'})
- If
token
option is set, it will be used. - If
process.env.GITHUB_ACCESS_TOKEN
is set, it will be used. - If neither is set, an unauthenticated request will be made.
If you don't like promises, you can use a node-style callback:
repoImages('user/repo', function(err, images) {
if (err) throw err
console.log(images)
})
npm install
npm test
- gh-got: Convenience wrapper for
got
to interact with the GitHub API - pify: Promisify a callback-style function
- standard: JavaScript Standard Style
- tap-spec: Formatted TAP output like Mocha's spec reporter
- tape: tap-producing test harness for node and browsers
MIT
Generated by package-json-to-readme