Get paths for storing things like data, config, cache, etc
Installations
npm install env-paths
Score
99.4
Supply Chain
99.4
Quality
75.6
Maintenance
100
Vulnerability
100
License
Developer
sindresorhus
Developer Guide
Module System
ESM
Min. Node Version
^12.20.0 || ^14.13.1 || >=16.0.0
Typescript Support
No
Node Version
14.17.5
NPM Version
7.20.3
Statistics
381 Stars
28 Commits
16 Forks
8 Watching
1 Branches
7 Contributors
Updated on 09 Nov 2024
Bundle Size
1.35 kB
Minified
636.00 B
Minified + Gzipped
Languages
JavaScript (89.87%)
TypeScript (10.13%)
Total Downloads
Cumulative downloads
Total Downloads
1,951,095,853
Last day
-18.7%
2,995,421
Compared to previous day
Last week
-4%
19,153,095
Compared to previous week
Last month
2.9%
82,941,490
Compared to previous month
Last year
60.9%
760,341,236
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
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
1import envPaths from 'env-paths'; 2 3const paths = envPaths('MyApp'); 4 5paths.data; 6//=> '/home/sindresorhus/.local/share/MyApp-nodejs' 7 8paths.config 9//=> '/home/sindresorhus/.config/MyApp-nodejs'
API
paths = envPaths(name, options?)
Note: It only generates the path strings. It doesn't create the directories for you. You could use make-dir
to create the directories.
name
Type: string
The name of your project. Used to generate the paths.
options
Type: object
suffix
Type: string
Default: 'nodejs'
Don't use this option unless you really have to!
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.
Example locations (with the default nodejs
suffix):
- macOS:
~/Library/Application Support/MyApp-nodejs
- Windows:
%LOCALAPPDATA%\MyApp-nodejs\Data
(for example,C:\Users\USERNAME\AppData\Local\MyApp-nodejs\Data
) - Linux:
~/.local/share/MyApp-nodejs
(or$XDG_DATA_HOME/MyApp-nodejs
)
paths.config
Directory for config files.
Example locations (with the default nodejs
suffix):
- macOS:
~/Library/Preferences/MyApp-nodejs
- Windows:
%APPDATA%\MyApp-nodejs\Config
(for example,C:\Users\USERNAME\AppData\Roaming\MyApp-nodejs\Config
) - Linux:
~/.config/MyApp-nodejs
(or$XDG_CONFIG_HOME/MyApp-nodejs
)
paths.cache
Directory for non-essential data files.
Example locations (with the default nodejs
suffix):
- macOS:
~/Library/Caches/MyApp-nodejs
- Windows:
%LOCALAPPDATA%\MyApp-nodejs\Cache
(for example,C:\Users\USERNAME\AppData\Local\MyApp-nodejs\Cache
) - Linux:
~/.cache/MyApp-nodejs
(or$XDG_CACHE_HOME/MyApp-nodejs
)
paths.log
Directory for log files.
Example locations (with the default nodejs
suffix):
- macOS:
~/Library/Logs/MyApp-nodejs
- Windows:
%LOCALAPPDATA%\MyApp-nodejs\Log
(for example,C:\Users\USERNAME\AppData\Local\MyApp-nodejs\Log
) - Linux:
~/.local/state/MyApp-nodejs
(or$XDG_STATE_HOME/MyApp-nodejs
)
paths.temp
Directory for temporary files.
Example locations (with the default nodejs
suffix):
- macOS:
/var/folders/jf/f2twvvvs5jl_m49tf034ffpw0000gn/T/MyApp-nodejs
- Windows:
%LOCALAPPDATA%\Temp\MyApp-nodejs
(for example,C:\Users\USERNAME\AppData\Local\Temp\MyApp-nodejs
) - Linux:
/tmp/USERNAME/MyApp-nodejs
Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
security policy file detected
Details
- Info: security policy file detected: .github/security.md:1
- Info: Found linked content: .github/security.md:1
- Info: Found disclosure, vulnerability, and/or timelines in security policy: .github/security.md:1
- Info: Found text in security policy: .github/security.md:1
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: license:0
- Info: FSF or OSI recognized license: MIT License: license:0
Reason
0 existing vulnerabilities detected
Reason
Found 7/28 approved changesets -- score normalized to 2
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/main.yml:1
- Info: no jobLevel write permissions found
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/sindresorhus/env-paths/main.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/sindresorhus/env-paths/main.yml/main?enable=pin
- Warn: npmCommand not pinned by hash: .github/workflows/main.yml:20
- Info: 0 out of 2 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 1 npmCommand dependencies pinned
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'main'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 7 are checked with a SAST tool
Score
4.2
/10
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More