1.0.0 • Published 8 years ago
gh-rate-limit v1.0.0
gh-rate-limit
Get your current rate limit status of the Github API
const ghRateLimit = require('gh-rate-limit');
ghRateLimit({
token: 'xxxx' // your Github API access token
}).then(status => {
status;
/* =>
{
core: {
limit: 5000,
remaining: 4861,
reset: 1451463150
},
search: {
limit: 30,
remaining: 30,
reset: 1451459998
}
}
*/
});
Installation
npm install gh-rate-limit
API
const ghRateLimit = require('gh-rate-limit');
ghRateLimit(options)
options: Object
(gh-get
options)
Return: Promise
instance
It makes an API request to get your current Github API rate limit status, and returns a promise.
The promise will be fulfilled with a JSON object if successful, otherwise rejected with an error.
ghRateLimit().then(status => {
// Get the status for unauthenticated requests if no token specified.
status;
/* =>
{
core: {
limit: 60,
remaining: 60,
reset: 1451463150
},
search: {
limit: 10,
remaining: 10,
reset: 1451459998
}
}
*/
});
License
Copyright (c) 2015 Shinnosuke Watanabe
Licensed under the MIT License.