1 | declare namespace envPaths {
|
---|
2 | export interface Options {
|
---|
3 | /**
|
---|
4 | __Don't use this option unless you really have to!__
|
---|
5 |
|
---|
6 | Suffix appended to the project name to avoid name conflicts with native apps. Pass an empty string to disable it.
|
---|
7 |
|
---|
8 | @default 'nodejs'
|
---|
9 | */
|
---|
10 | readonly suffix?: string;
|
---|
11 | }
|
---|
12 |
|
---|
13 | export interface Paths {
|
---|
14 | /**
|
---|
15 | Directory for data files.
|
---|
16 |
|
---|
17 | Example locations (with the default `nodejs` suffix):
|
---|
18 |
|
---|
19 | - macOS: `~/Library/Application Support/MyApp-nodejs`
|
---|
20 | - Windows: `%LOCALAPPDATA%\MyApp-nodejs\Data` (for example, `C:\Users\USERNAME\AppData\Local\MyApp-nodejs\Data`)
|
---|
21 | - Linux: `~/.local/share/MyApp-nodejs` (or `$XDG_DATA_HOME/MyApp-nodejs`)
|
---|
22 | */
|
---|
23 | readonly data: string;
|
---|
24 |
|
---|
25 | /**
|
---|
26 | Directory for data files.
|
---|
27 |
|
---|
28 | Example locations (with the default `nodejs` suffix):
|
---|
29 |
|
---|
30 | - macOS: `~/Library/Preferences/MyApp-nodejs`
|
---|
31 | - Windows: `%APPDATA%\MyApp-nodejs\Config` (for example, `C:\Users\USERNAME\AppData\Roaming\MyApp-nodejs\Config`)
|
---|
32 | - Linux: `~/.config/MyApp-nodejs` (or `$XDG_CONFIG_HOME/MyApp-nodejs`)
|
---|
33 | */
|
---|
34 | readonly config: string;
|
---|
35 |
|
---|
36 | /**
|
---|
37 | Directory for non-essential data files.
|
---|
38 |
|
---|
39 | Example locations (with the default `nodejs` suffix):
|
---|
40 |
|
---|
41 | - macOS: `~/Library/Caches/MyApp-nodejs`
|
---|
42 | - Windows: `%LOCALAPPDATA%\MyApp-nodejs\Cache` (for example, `C:\Users\USERNAME\AppData\Local\MyApp-nodejs\Cache`)
|
---|
43 | - Linux: `~/.cache/MyApp-nodejs` (or `$XDG_CACHE_HOME/MyApp-nodejs`)
|
---|
44 | */
|
---|
45 | readonly cache: string;
|
---|
46 |
|
---|
47 | /**
|
---|
48 | Directory for log files.
|
---|
49 |
|
---|
50 | Example locations (with the default `nodejs` suffix):
|
---|
51 |
|
---|
52 | - macOS: `~/Library/Logs/MyApp-nodejs`
|
---|
53 | - Windows: `%LOCALAPPDATA%\MyApp-nodejs\Log` (for example, `C:\Users\USERNAME\AppData\Local\MyApp-nodejs\Log`)
|
---|
54 | - Linux: `~/.local/state/MyApp-nodejs` (or `$XDG_STATE_HOME/MyApp-nodejs`)
|
---|
55 | */
|
---|
56 | readonly log: string;
|
---|
57 |
|
---|
58 | /**
|
---|
59 | Directory for temporary files.
|
---|
60 |
|
---|
61 | Example locations (with the default `nodejs` suffix):
|
---|
62 |
|
---|
63 | - macOS: `/var/folders/jf/f2twvvvs5jl_m49tf034ffpw0000gn/T/MyApp-nodejs`
|
---|
64 | - Windows: `%LOCALAPPDATA%\Temp\MyApp-nodejs` (for example, `C:\Users\USERNAME\AppData\Local\Temp\MyApp-nodejs`)
|
---|
65 | - Linux: `/tmp/USERNAME/MyApp-nodejs`
|
---|
66 | */
|
---|
67 | readonly temp: string;
|
---|
68 | }
|
---|
69 | }
|
---|
70 |
|
---|
71 | declare const envPaths: {
|
---|
72 | /**
|
---|
73 | Get paths for storing things like data, config, cache, etc.
|
---|
74 |
|
---|
75 | Note: It only generates the path strings. It doesn't create the directories for you. You could use [`make-dir`](https://github.com/sindresorhus/make-dir) to create the directories.
|
---|
76 |
|
---|
77 | @param name - Name of your project. Used to generate the paths.
|
---|
78 | @returns The paths to use for your project on current OS.
|
---|
79 |
|
---|
80 | @example
|
---|
81 | ```
|
---|
82 | import envPaths = require('env-paths');
|
---|
83 |
|
---|
84 | const paths = envPaths('MyApp');
|
---|
85 |
|
---|
86 | paths.data;
|
---|
87 | //=> '/home/sindresorhus/.local/share/MyApp-nodejs'
|
---|
88 |
|
---|
89 | paths.config
|
---|
90 | //=> '/home/sindresorhus/.config/MyApp-nodejs'
|
---|
91 | ```
|
---|
92 | */
|
---|
93 | (name: string, options?: envPaths.Options): envPaths.Paths;
|
---|
94 |
|
---|
95 | // TODO: Remove this for the next major release, refactor the whole definition to:
|
---|
96 | // declare function envPaths(name: string, options?: envPaths.Options): envPaths.Paths;
|
---|
97 | // export = envPaths;
|
---|
98 | default: typeof envPaths;
|
---|
99 | };
|
---|
100 |
|
---|
101 | export = envPaths;
|
---|