npm-to-github

2.1.1 • Public • Published

npm-to-github

Get the GitHub repository from a npm package.

Installation

$ npm install npm-to-github --save

Usage

const npmToGitHub = require('npm-to-github');

Get repository name

npmToGitHub.getRepositoryName('npm-to-github')
.then((name) => {
    console.log(name);
})
.catch((error) => {
    console.log(error);
});

Get repository data

npmToGitHub.getRepository('npm-to-github')
.then((data) => {
    console.log(data);
})
.catch((error) => {
    console.log(error);
});

GitHub API rate limit

GitHub API is limited to 60 requests, after which you get an error:

API rate limit exceeded for a.b.c.d. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)

A work around is to authenticate. npm-to-github supports token based authentication. The token doesn't need any scope or permission.

const npmToGitHub = require('npm-to-github');
npmToGitHub.setToken('d5ea195..........................4bde396');

Incompatible API changes! (f34r)

In 1.x errors where not really errors, only a message. In 2.x errors are full Error objects.

License

Released under the MIT license.

Package Sidebar

Install

npm i npm-to-github

Weekly Downloads

0

Version

2.1.1

License

MIT

Unpacked Size

26.9 kB

Total Files

10

Last publish

Collaborators

  • oliviercoilland