Socket
Socket
Sign inDemoInstall

xdg-basedir

Package Overview
Dependencies
1
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    xdg-basedir

Get XDG Base Directory paths


Version published
Weekly downloads
8M
decreased by-8.03%
Maintainers
1
Install size
9.15 kB
Created
Weekly downloads
 

Readme

Source

xdg-basedir Build Status

Get XDG Base Directory paths

Install

$ npm install --save xdg-basedir

Usage

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.

.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

Keywords

FAQs

Last updated on 13 Jan 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc