xdg-basedir

5.1.0last stable release 4 years ago
Complexity Score
Low
Open Issues
0
Dependent Projects
355
Weekly Downloadsglobal
9,687,310

License

  • MIT
    • Yesattribution
    • Permissivelinking
    • Permissivedistribution
    • Permissivemodification
    • Nopatent grant
    • Yesprivate use
    • Permissivesublicensing
    • Notrademark grant

Downloads

Readme

xdg-basedir

Get XDG Base Directory paths

This package is meant for Linux. You should not use XDG on macOS or Windows. Instead, you should follow their platform conventions. You can use env-paths for that.

Install

$ npm install xdg-basedir

Usage

import {xdgData, xdgConfig, xdgDataDirectories} from 'xdg-basedir';

console.log(xdgData);
//=> '/home/sindresorhus/.local/share'

console.log(xdgConfig);
//=> '/home/sindresorhus/.config'

console.log(xdgDataDirectories);
//=> ['/home/sindresorhus/.local/share', '/usr/local/share/', '/usr/share/']

API

The exports xdgData, xdgConfig, xdgCache, xdgRuntime will return undefined in the uncommon case that both the XDG environment variable is not set and the users home directory can’t be found. You need to handle this case. A common solution is to fall back to a temporary directory.

xdgData

Directory for user-specific data files.

xdgConfig

Directory for user-specific configuration files.

xdgState

Directory for user-specific state files.

xdgCache

Directory for user-specific non-essential data files.

xdgRuntime

Directory for user-specific non-essential runtime files and other file objects (such as sockets, named pipes, etc).

xdgDataDirectories

Preference-ordered array of base directories to search for data files in addition to xdgData.

xdgConfigDirectories

Preference-ordered array of base directories to search for configuration files in addition to xdgConfig.

Get professional support for this package with a Tidelift subscription
Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.

Dependencies

No runtime dependency information found for this package.

CVE IssuesActive
0
Scorecards Score
4.20
Test Coverage
No Data
Follows Semver
Yes
Github Stars
82
Dependenciestotal
4
DependenciesOutdated
3
DependenciesDeprecated
0
Threat Modelling
No
Repo Audits
No

Learn how to distribute xdg-basedir in your own private NPM registry

npm config set registry  https://npm.cloudsmith.com/owner/repo
Processing...
Done
npm install xdg-basedir
Processing...
Done

8 Releases

NPM on Cloudsmith

Getting started with NPM on Cloudsmith is fast and easy.