Sha256: 7938275aa8316e4d5d76361d1b2a80e4837f41e325c39f9bd8ef11319ca8e28a

Contents?: true

Size: 1.54 KB

Versions: 62

Compression:

Stored size: 1.54 KB

Contents

# xdg-basedir [![Build Status](https://travis-ci.org/sindresorhus/xdg-basedir.svg?branch=master)](https://travis-ci.org/sindresorhus/xdg-basedir)

> Get [XDG Base Directory](http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html) paths


## Install

```
$ npm install --save xdg-basedir
```


## Usage

```js
var 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](https://github.com/yeoman/configstore/blob/b82690fc401318ad18dcd7d151a0003a4898a314/index.js#L15).

### .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](http://sindresorhus.com)

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
trusty-festivity-extension-2.6.3 node_modules/bower/node_modules/insight/node_modules/configstore/node_modules/xdg-basedir/readme.md
trusty-festivity-extension-2.6.2 node_modules/bower/node_modules/insight/node_modules/configstore/node_modules/xdg-basedir/readme.md
trusty-festivity-extension-2.6.1 node_modules/bower/node_modules/insight/node_modules/configstore/node_modules/xdg-basedir/readme.md
trusty-festivity-extension-2.6 node_modules/bower/node_modules/insight/node_modules/configstore/node_modules/xdg-basedir/readme.md
trusty-festivity-extension-2.5.19 node_modules/bower/node_modules/insight/node_modules/configstore/node_modules/xdg-basedir/readme.md
trusty-festivity-extension-2.5.18 node_modules/bower/node_modules/insight/node_modules/configstore/node_modules/xdg-basedir/readme.md
trusty-festivity-extension-2.5.17 node_modules/bower/node_modules/insight/node_modules/configstore/node_modules/xdg-basedir/readme.md
trusty-festivity-extension-2.5.16 node_modules/bower/node_modules/insight/node_modules/configstore/node_modules/xdg-basedir/readme.md
trusty-festivity-extension-2.5.15 node_modules/bower/node_modules/insight/node_modules/configstore/node_modules/xdg-basedir/readme.md
trusty-festivity-extension-2.5.14 node_modules/bower/node_modules/insight/node_modules/configstore/node_modules/xdg-basedir/readme.md
trusty-festivity-extension-2.5.13 node_modules/bower/node_modules/insight/node_modules/configstore/node_modules/xdg-basedir/readme.md
trusty-festivity-extension-2.5.12 node_modules/bower/node_modules/insight/node_modules/configstore/node_modules/xdg-basedir/readme.md
trusty-festivity-extension-2.5.11 node_modules/bower/node_modules/insight/node_modules/configstore/node_modules/xdg-basedir/readme.md
trusty-festivity-extension-2.5.10 node_modules/bower/node_modules/insight/node_modules/configstore/node_modules/xdg-basedir/readme.md
trusty-festivity-extension-2.5.9 node_modules/bower/node_modules/insight/node_modules/configstore/node_modules/xdg-basedir/readme.md
trusty-festivity-extension-2.5.8 node_modules/bower/node_modules/insight/node_modules/configstore/node_modules/xdg-basedir/readme.md
trusty-festivity-extension-2.5.7 node_modules/bower/node_modules/insight/node_modules/configstore/node_modules/xdg-basedir/readme.md
trusty-festivity-extension-2.5.6 node_modules/bower/node_modules/insight/node_modules/configstore/node_modules/xdg-basedir/readme.md
trusty-festivity-extension-2.5.5 node_modules/bower/node_modules/insight/node_modules/configstore/node_modules/xdg-basedir/readme.md
trusty-festivity-extension-2.5.4 node_modules/bower/node_modules/insight/node_modules/configstore/node_modules/xdg-basedir/readme.md