blob: ec3439316f9a1b7453853cb5953a428bf43a3707 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
# env-paths [![Build Status](https://travis-ci.org/sindresorhus/env-paths.svg?branch=master)](https://travis-ci.org/sindresorhus/env-paths)
> Get paths for storing things like data, config, cache, etc
Uses the correct OS-specific paths. Most developers get this wrong.
## Install
```
$ npm install env-paths
```
## Usage
```js
const envPaths = require('env-paths');
const paths = envPaths('MyApp');
paths.data;
//=> '/home/sindresorhus/.local/share/MyApp-nodejs'
paths.config
//=> '/home/sindresorhus/.config/MyApp-nodejs'
```
## API
### paths = envPaths(name, [options])
#### name
Type: `string`
Name of your project. Used to generate the paths.
#### options
Type: `Object`
##### suffix
Type: `string`<br>
Default: `'nodejs'`
**Don't use this option unless you really have to!**<br>
Suffix appended to the project name to avoid name conflicts with native
apps. Pass an empty string to disable it.
### paths.data
Directory for data files.
### paths.config
Directory for config files.
### paths.cache
Directory for non-essential data files.
### paths.log
Directory for log files.
### paths.temp
Directory for temporary files.
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)
|