1
|
# home-or-tmp [](https://travis-ci.org/sindresorhus/home-or-tmp)
|
2
|
|
3
|
> Get the user home directory with fallback to the system temp directory
|
4
|
|
5
|
Useful in cases where the home directory either isn't set or doesn't exist.
|
6
|
|
7
|
|
8
|
## Install
|
9
|
|
10
|
```
|
11
|
$ npm install --save home-or-tmp
|
12
|
```
|
13
|
|
14
|
|
15
|
## Usage
|
16
|
|
17
|
```js
|
18
|
var homeOrTmp = require('home-or-tmp');
|
19
|
|
20
|
console.log(homeOrTmp);
|
21
|
//=> '/Users/sindresorhus'
|
22
|
|
23
|
// and if there's no home directory:
|
24
|
|
25
|
console.log(homeOrTmp);
|
26
|
//=> '/var/folders/m3/5574nnhn0yj488ccryqr7tc80000gn/T'
|
27
|
```
|
28
|
|
29
|
|
30
|
## License
|
31
|
|
32
|
MIT © [Sindre Sorhus](http://sindresorhus.com)
|