Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
github-username
Advanced tools
The github-username npm package is a simple utility that allows you to retrieve a GitHub username from an email address. This can be particularly useful for applications that need to map email addresses to GitHub profiles.
Retrieve GitHub Username
This feature allows you to retrieve the GitHub username associated with a given email address. The code sample demonstrates how to use the package to get the username asynchronously.
const githubUsername = require('github-username');
(async () => {
const username = await githubUsername('email@example.com');
console.log(username);
})();
The gh-user package allows you to fetch detailed information about a GitHub user by their username. Unlike github-username, which maps an email to a username, gh-user provides more comprehensive user data such as name, bio, and repositories.
The github-api package is a more general-purpose library for interacting with the GitHub API. It allows you to perform a wide range of actions, including fetching user data, repositories, and issues. While it can be used to get user information, it requires more setup and is not as specialized as github-username.
Octokit is the official GitHub REST API client for JavaScript. It provides a comprehensive set of tools for interacting with GitHub's API, including user data retrieval. However, it is more complex and feature-rich compared to the lightweight and focused github-username package.
Get a GitHub username from an email address
$ npm install --save github-username
var githubUsername = require('github-username');
githubUsername('sindresorhus@gmail.com', function (err, username) {
console.log(username);
//=> 'sindresorhus'
});
Required
Type: string
Email address for the user of whom you want the username.
Type: string
GitHub personal access token.
You can also use it as a CLI app by installing it globally:
$ npm install --global github-username
$ github-username --help
Usage
$ github-username <email> [--token OAUTH-TOKEN]
$ echo <email> | github-username
Example
$ github-username sindresorhus@gmail.com
sindresorhus
FAQs
Get a GitHub username from an email address
The npm package github-username receives a total of 473,379 weekly downloads. As such, github-username popularity was classified as popular.
We found that github-username demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.