gh-rate-limit

1.0.0 • Public • Published

gh-rate-limit

NPM version Build Status Coverage Status Dependency Status devDependency Status

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

Use npm.

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.

Package Sidebar

Install

npm i gh-rate-limit

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • shinnn