1.0.1 • Published 2 years ago
@hugoalh/environment-paths v1.0.1
Environment Paths (NodeJS)
Releases | Latest () | Pre () |
---|---|---|
📝 Description
A NodeJS module to get the correct OS-specific absolute environment paths for the current user.
Type | Windows | MacOS | Linux |
---|---|---|---|
Cache | %LOCALAPPDATA%\{Name}\Cache / C:\Users\{Username}\AppData\Local\{Name}\Cache | ~/Library/Caches/{Name} | $XDG_CACHE_HOME/{Name} / ~/.cache/{Name} |
Config | %APPDATA%\{Name}\Config / C:\Users\{Username}\AppData\Roaming\{Name}\Config | ~/Library/Preferences/{Name} | $XDG_CONFIG_HOME/{Name} / ~/.config/{Name} |
Data | %LOCALAPPDATA%\{Name}\Data / C:\Users\{Username}\AppData\Local\{Name}\Data | ~/Library/Application Support/{Name} | $XDG_DATA_HOME/{Name} / ~/.local/share/{Name} |
Download | ~\Downloads / C:\Users\{Username}\Downloads | ~/Downloads | ~/Downloads |
Log | %LOCALAPPDATA%\{Name}\Log / C:\Users\{Username}\AppData\Local\{Name}\Log | ~/Library/Logs/{Name} | $XDG_STATE_HOME/{Name} / ~/.local/state/{Name} |
Temp | %LOCALAPPDATA%\Temp\{Name} / C:\Users\{Username}\AppData\Local\Temp\{Name} | /var/folders/jf/f2twvvvs5jl_m49tf034ffpw0000gn/T/{Name} * | /tmp/{Username}/{Name} |
*: Path contains random EUID.
This project is inspired from env-paths
(GitHub)(NPM).
⚠ Important
- This module only generates the path strings and does not create the directories.
📚 Documentation
Getting Started
Install
- NodeJS >= v10.13.0
npm install @hugoalh/environment-paths
Use
CommonJS
const environmentPaths = require("@hugoalh/environment-paths");
ModuleJS
import environmentPaths from "@hugoalh/environment-paths";
API
Function
environmentPaths(name: string/* Application name.*/): {
cache: string,
config: string,
data: string,
download: string,
log: string,
temp: string
}