# gh-rate-limit

> Get your current rate limit status of the Github API

Latest version **1.0.0** (published 2015-12-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install gh-rate-limit
pnpm add gh-rate-limit
yarn add gh-rate-limit
bun add gh-rate-limit
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2015-12-30 |
| First published | 2015-12-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Shinnosuke Watanabe |
| Maintainers | shinnn |
| Keywords | gh, github, api, github-api, rate, limit, rate-limit, status, json, get, request, promise, promises, then, async, asynchronous, asynchronously |

## Links

- npm: https://www.npmjs.com/package/gh-rate-limit
- Repository: https://github.com/shinnn/gh-rate-limit
- Homepage: https://github.com/shinnn/gh-rate-limit#readme
- Issues: https://github.com/shinnn/gh-rate-limit/issues
- npm.io page: https://npm.io/package/gh-rate-limit

## Dependencies (1)

- [gh-get](https://npm.io/package/gh-get.md) ^1.0.1

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.0.0 (latest) — 2015-12-30
- 0.0.0 — 2015-12-30

## README

# gh-rate-limit

[![NPM version](https://img.shields.io/npm/v/gh-rate-limit.svg)](https://www.npmjs.com/package/gh-rate-limit)
[![Build Status](https://travis-ci.org/shinnn/gh-rate-limit.svg?branch=master)](https://travis-ci.org/shinnn/gh-rate-limit)
[![Coverage Status](https://img.shields.io/coveralls/shinnn/gh-rate-limit.svg)](https://coveralls.io/github/shinnn/gh-rate-limit)
[![Dependency Status](https://david-dm.org/shinnn/gh-rate-limit.svg)](https://david-dm.org/shinnn/gh-rate-limit)
[![devDependency Status](https://david-dm.org/shinnn/gh-rate-limit/dev-status.svg)](https://david-dm.org/shinnn/gh-rate-limit#info=devDependencies)

Get your current [rate limit](https://developer.github.com/v3/#rate-limiting) status of the [Github API](https://developer.github.com/v3/#overview)

```javascript
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.](https://docs.npmjs.com/cli/install)

```
npm install gh-rate-limit
```

## API

```javascript
const ghRateLimit = require('gh-rate-limit');
```

### ghRateLimit([*options*])

*options*: `Object` ([`gh-get` options](https://github.com/shinnn/gh-get#options))  
Return: [`Promise`](http://www.ecma-international.org/ecma-262/6.0/#sec-promise-constructor) instance

It makes an [API](https://developer.github.com/v3/) request to [get your current Github API rate limit status](https://developer.github.com/v3/gists/#unstar-a-gist), and returns a promise.

The promise will be [*fulfilled*](https://promisesaplus.com/#point-26) with a [JSON object](https://developer.github.com/v3/rate_limit/#response) if successful, otherwise [*rejected*](https://promisesaplus.com/#point-30) with an error.

```javascript
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](https://github.com/shinnn)

Licensed under [the MIT License](./LICENSE).

---
_Source: https://npm.io/package/gh-rate-limit · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
