1.0.1 • Published 2 years ago

@hugoalh/environment-paths v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Environment Paths (NodeJS)

EnvironmentPaths.NodeJS

NodeJS License GitHub Stars GitHub Contributors GitHub Issues GitHub Pull Requests GitHub Discussions CodeFactor Grade

ReleasesLatest (GitHub Latest Release Date)Pre (GitHub Latest Pre-Release Date)
GitHub GitHub Total DownloadsGitHub Latest Release VersionGitHub Latest Pre-Release Version
NPM NPM Total DownloadsNPM Latest Release VersionNPM Latest Pre-Release Version

📝 Description

A NodeJS module to get the correct OS-specific absolute environment paths for the current user.

TypeWindowsMacOSLinux
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
}