xdg-basedir
Get XDG Base Directory paths
Last updated a year ago by sindresorhus .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install xdg-basedir 
SYNC missed versions from official npm registry.

xdg-basedir Build Status

Get XDG Base Directory paths

Install

$ npm install xdg-basedir

Usage

const xdgBasedir = require('xdg-basedir');

xdgBasedir.data;
//=> '/home/sindresorhus/.local/share'

xdgBasedir.config;
//=> '/home/sindresorhus/.config'

xdgBasedir.dataDirs
//=> ['/home/sindresorhus/.local/share', '/usr/local/share/', '/usr/share/']

API

The properties .data, .config, .cache, .runtime will return null 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 temp directory.

.data

Directory for user-specific data files.

.config

Directory for user-specific configuration files.

.cache

Directory for user-specific non-essential data files.

.runtime

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

.dataDirs

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

.configDirs

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

License

MIT © Sindre Sorhus

Current Tags

  • 4.0.0                                ...           latest (a year ago)

5 Versions

  • 4.0.0                                ...           a year ago
  • 3.0.0                                ...           3 years ago
  • 2.0.0                                ...           5 years ago
  • 1.0.1                                ...           5 years ago
  • 1.0.0                                ...           6 years ago
Maintainers (1)
Downloads
Today 1,031
This Week 59,505
This Month 35,635
Last Day 11,179
Last Week 54,173
Last Month 268,539
Dependencies (0)
None
Dev Dependencies (4)
Dependents (113)

Copyright 2014 - 2016 © taobao.org |