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 common OS paths (home, temp, ...)

  • 4.3.0
  • Source
  • npm
  • Socket score

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

os-paths

Generate portable common OS paths (home and temp)

Build status Build status Build status Coverage status License Javascript Style Guide  
Repository NPM version NodeJS version Downloads

Installation

npm install os-paths
Requirements

NodeJS >= 6.0

Usage

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

osPaths.home();
//(*nix) => '/home/rivy'
//(win)  => 'C:\Users\RIvy'

osPaths.temp();
//(*nix) => '/tmp'
//(win)  => 'C:\temp'

API

Initialization

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

The object returned by the module constructor is an OSPaths function object, augmented with attached methods. When called directly (eg, const p = osPaths()), it returns a newly constructed OSPaths object. Since the OSPaths object contains no instance state, all constructed objects will be functionally identical.

Methods

All module methods return simple, platform-compatible, path strings.

The path strings are not guaranteed to already exist on the file system. So, the user is responsible for directory construction, if/when needed. However, since all of these are standard OS directories, they should all exist without the need for user intervention.

If/when necessary, make-dir or mkdirp can be used to create the directories.

osPaths.home(): string

Returns the home directory for user

osPaths.temp(): string

Returns the directory for temporary files

XDG

All XDG-related methods have been relocated to the xdg-portable and xdg-app-paths modules.

  • xdg-app-paths ... easy XDG for applications
  • xdg-portable ... XDG Base Directory paths (cross-platform)

License

MIT © Roy Ivy III, Sindre Sorhus

Keywords

FAQs

Package last updated on 14 Dec 2020

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