# userhomepath

> Platform agnostic user home directory path resolution for Node.js.

Latest version **1.0.6** (published 2018-02-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install userhomepath
pnpm add userhomepath
yarn add userhomepath
bun add userhomepath
```

Provides the command `userhomepath`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.6 |
| Published | 2018-02-05 |
| First published | 2018-02-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | lufinkey |
| Maintainers | lufinkey |
| Keywords | userhome, user, home, homedir, homepath, home_dir, passwd(5), username, userpath |

## Links

- npm: https://www.npmjs.com/package/userhomepath
- Repository: https://github.com/lufinkey/node-userhomepath
- Homepage: https://github.com/lufinkey/node-userhomepath#readme
- Issues: https://github.com/lufinkey/node-userhomepath/issues
- npm.io page: https://npm.io/package/userhomepath

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 1.0.6 (latest) — 2018-02-05
- 1.0.5 — 2018-02-05
- 1.0.4 — 2018-02-04
- 1.0.3 — 2018-02-04
- 1.0.2 — 2018-02-04
- 1.0.1 — 2018-02-04
- 1.0.0 — 2018-02-04

## README

# userhomepath

 Platform agnostic user home directory path resolution for Node.js
  
 While `os.userInfo().homedir` or `os.homedir` can give you the home directory for the current user, this module will give you the home directory for *any* user, including system users.

## Install

```bash
npm install --save userhomepath
```

## Usage

```javascript
const { homedir } = require('userhomepath');

// find the home directory for user "luis", and log it to the console
homedir('luis').then(userPath) {
	// success
	console.log(userPath);
}).catch(error) {
	// error
	console.error("error: "+error.message);
});
```

The **homedir** function attempts to resolve the home directory of the given (*case-sensitive*, except on Windows) username.
A **homedirSync** function is also provided, which blocks until the function finishes.
If the user does not exist, or if the operation couldn't be completed, an exception is thrown.
If the user exists, but does not have a home directory, null is returned.
Upon success, a string containing the fully qualified path to the user's home directory is returned.

### CLI

For testing purposes, I also included a cli:

```bash
# find the home directory for user "luis"
userhomepath luis
```

## License

  [MIT](LICENSE.md)

---
_Source: https://npm.io/package/userhomepath · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
