Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

os-paths

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

os-paths

Generate portable (and XDG-compatible) paths for storing cache, config, data, etc

  • 3.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
636K
decreased by-0.31%
Maintainers
1
Weekly downloads
 
Created
Source

os-paths Build Status

Get paths for storing things like data, config, cache, etc

Uses the correct OS-specific paths. Most developers get this wrong.

Install

npm install os-paths

Usage

const osPaths = require('os-paths');

const paths = osPaths('MyApp');

paths.data;
//=> '/home/rivy/.local/share/MyApp-nodejs'

paths.config
//=> '/home/rivy/.config/MyApp-nodejs'

API

paths = osPaths(name, [options])

Note: It only generates the path strings. It doesn't create the directories for you. You could use make-dir to create the directories.

name

Type: string

Name of your project. Used to generate the paths.

options

Type: Object

suffix

Type: string
Default: 'nodejs'

Don't use this option unless you really have to!
Suffix appended to the project name to avoid name conflicts with native apps. Pass an empty string to disable it.

paths.data

Directory for data files.

paths.config

Directory for config files.

paths.cache

Directory for non-essential data files.

paths.log

Directory for log files.

paths.temp

Directory for temporary files.

License

MIT © Roy Ivy III, Sindre Sorhus

Keywords

FAQs

Package last updated on 29 Jun 2019

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc