1 | # github-username [![Build Status](https://travis-ci.org/sindresorhus/github-username.svg?branch=master)](https://travis-ci.org/sindresorhus/github-username)
|
2 |
|
3 | > Get a GitHub username from an email address
|
4 |
|
5 | *Only works for users that have their email publicly listed on their profile.*
|
6 |
|
7 |
|
8 | ## Install
|
9 |
|
10 | ```sh
|
11 | $ npm install --save github-username
|
12 | ```
|
13 |
|
14 |
|
15 | ## Usage
|
16 |
|
17 | ```js
|
18 | var githubUsername = require('github-username');
|
19 |
|
20 | githubUsername('sindresorhus@gmail.com', function (err, username) {
|
21 | console.log(username);
|
22 | //=> 'sindresorhus'
|
23 | });
|
24 | ```
|
25 |
|
26 |
|
27 | ## API
|
28 |
|
29 | ### githubUsername(email, [token], callback)
|
30 |
|
31 | #### email
|
32 |
|
33 | *Required*
|
34 | Type: `string`
|
35 |
|
36 | Email address for the user of whom you want the username.
|
37 |
|
38 | #### token
|
39 |
|
40 | Type: `string`
|
41 |
|
42 | GitHub [personal access token](https://github.com/settings/applications#personal-access-tokens).
|
43 |
|
44 | #### callback(err, username)
|
45 |
|
46 |
|
47 | ## CLI
|
48 |
|
49 | ```sh
|
50 | $ npm install --global github-username
|
51 | ```
|
52 |
|
53 | ```sh
|
54 | $ github-username --help
|
55 |
|
56 | Usage
|
57 | github-username <email> [--token OAUTH-TOKEN]
|
58 | echo <email> | github-username
|
59 |
|
60 | Example
|
61 | github-username sindresorhus@gmail.com
|
62 | sindresorhus
|
63 | ```
|
64 |
|
65 |
|
66 | ## License
|
67 |
|
68 | MIT © [Sindre Sorhus](http://sindresorhus.com)
|