gh-stars
gh-stars copied to clipboard
API and CLI for getting the stars for one or more GitHub users or organizations.
gh-stars

Get the stars for one or more GitHub users or organizations.
Follow this project's author, Jon Schlinkert, for updates on this project and others.
Install
Install with npm:
$ npm install --save gh-stars
Usage
Params
-
names
{String|Array}: One or more GitHub user or organization names. -
options
{Options} -
returns
{Promise}
Example
var stars = require('gh-stars');
stars(['doowb', 'jonschlinkert'], {token: 'YOUR_GITHUB_AUTH_TOKEN'})
.then(function(res) {
console.log(res);
})
.catch(console.error)
Options
options.format
Type: String|Function
Default: API defaults to json
, CLI defaults to markdown
.
Description
The format to use for the returned report. A custom function may be defined, or optionally choose one of the available formats:
-
json
- this is the default when used by API -
markdown
(ormd
) - returns a markdown table, this is the default when used by CLI -
raw
- no formatting is applied
Example
var stars = require('gh-stars');
stars(['doowb', 'jonschlinkert'], {token: 'YOUR_GITHUB_AUTH_TOKEN', format: 'md'})
.then(function(res) {
// res would be formatted as markdown
console.log(res);
})
.catch(console.error)
options.filter
Type: Function
Default: Filters out private repositories and forks by default.
Description: Custom function to filter out repositories from the result.
Example
var stars = require('gh-stars');
stars(['doowb', 'jonschlinkert'], {
token: 'YOUR_GITHUB_AUTH_TOKEN',
filter: function(repo) {
return repo.name !== 'foo';
}
})
.then(function(res) {
// res would be formatted as markdown
console.log(res);
})
.catch(console.error)
CLI
$ stars <names> <dest> [options]
-
names
- one or more comma-separated user names or orgs -
dest
- destination path to use, default isstars.md
Options
-
--format
- the format to use.
Example markdown report
This is a small cross-section of stars for @doowb's repos:
| **Stars** | **Name** |
| --- | --- |
| 3408 | assemble |
| 1410 | handlebars-helpers |
| 364 | verb |
| 309 | micromatch |
| 5491 | TOTAL |
About
Related projects
You might also be interested in these projects:
- gists: Methods for working with the GitHub Gist API. Node.js/JavaScript | homepage
- github-base: JavaScript wrapper that greatly simplifies working with GitHub's API. | homepage
- repos: List all repositories for one or more users or orgs. | homepage
- topics: Get and update GitHub repository topics. | homepage
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Please read the contributing guide for advice on opening issues, pull requests, and coding standards.
Building docs
(This project's readme.md is generated by verb, please don't edit the readme directly. Any changes to the readme must be made in the .verb.md readme template.)
To generate the readme, run the following command:
$ npm install -g verbose/verb#dev verb-generate-readme && verb
Running tests
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
$ npm install && npm test
Author
Jon Schlinkert
License
Copyright © 2017, Jon Schlinkert. Released under the MIT License.
This file was generated by verb-generate-readme, v0.6.0, on September 12, 2017.