Socket
Socket
Sign inDemoInstall

xdg-basedir

Package Overview
Dependencies
0
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
Maintainers
1
Weekly downloads
8,657,019
increased by2%
Install size
7.69 kB

Weekly downloads

Readme

Source

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.

Keywords

FAQs

Last updated on 05 Aug 2021

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