read-git-user
TypeScript icon, indicating that this package has built-in type declarations

2.1.0 • Public • Published

read-git-user build

Reads the Github username and email from .gitconfig 🔧 and returns it as a json object

Highlights

  • Tiny(1.3kB ✨) and simple
  • Returns the original github-username since the stored git name can be altered and not reliable.
  • Uses Ini to handle the parsing of the ini config file

Install

npm install read-git-user

Usage

import readGitUser = require('read-git-user');
 
(async () => {
        const gitUser = await readGitUser();
        //=> {username: RocktimsSaikia, email: rocktimthedev@gmail.com}
})();

API

readGitUser(options?)

Returns a Promise<object> with the parsed JSON.

options

dir

Type: string
Default: os.homedir()

The directory of the .gitconfig file

License

MIT © Rocktim Saikia

Package Sidebar

Install

npm i read-git-user

Weekly Downloads

0

Version

2.1.0

License

MIT

Unpacked Size

4.02 kB

Total Files

5

Last publish

Collaborators

  • rocktimsaikia