2.1.1 • Published 6 years ago
npm-to-github v2.1.1
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.