Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pcrab/pxdg
Last synced: 25 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/pcrab/pxdg
- Owner: Pcrab
- License: mit
- Created: 2022-09-29T13:05:37.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-09-29T13:36:47.000Z (over 2 years ago)
- Last Synced: 2024-12-08T00:38:40.226Z (about 1 month ago)
- Language: TypeScript
- Size: 74.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PXDG
A simple configuration helper library which respects XDG Base Directory settings.
## Usage
```typescript
import xdg from "@pcrab/pxdg";/**
* {
* XDG_CACHE_HOME: "/home/pcrab/.cache",
* XDG_CONFIG_DIRS: [ "/etc/xdg" ],
* XDG_CONFIG_HOME: "/home/pcrab/.config",
* XDG_DATA_DIRS: [ "/usr/local/share", "/usr/share" ],
* XDG_DATA_HOME: "/home/pcrab/.local/share",
* XDG_RUNTIME_DIR: "/mnt/wslg/runtime-dir",
* XDG_STATE_HOME: "/home/pcrab/.local/state"
* }
*/
console.log(xdg);
```It also has special support for `Windows`. However, because windows do not have
XDG Base Directory, these variables are set to `$env:APPDATA` or
`$env:LODALAPPDATA`.```typescript
/**
* {
* XDG_CACHE_HOME: "C:\\Users\\micro\\AppData\\Local\\cache",
* XDG_CONFIG_DIRS: [ "C:\\Users\\micro\\AppData\\Roaming", "C:\\ProgramData" ],
* XDG_CONFIG_HOME: "C:\\Users\\micro\\AppData\\Local",
* XDG_DATA_DIRS: [ "C:\\Users\\micro\\AppData\\Roaming", "C:\\ProgramData" ],
* XDG_DATA_HOME: "C:\\Users\\micro\\AppData\\Local",
* XDG_RUNTIME_DIR: "C:\\Users\\micro\\AppData\\Local",
* XDG_STATE_HOME: "C:\\Users\\micro\\AppData\\Local"
* }
*/
console.log(xdg);
```