Socket
Socket
Sign inDemoInstall

ospath

Package Overview
Dependencies
0
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

ospath

Operating system specific paths.


Version published
Maintainers
1
Weekly downloads
4,486,746
decreased by-9.03%

Weekly downloads

Package description

What is ospath?

The ospath npm package provides a simple and consistent way to work with operating system-specific path operations. It abstracts away the differences between Windows and POSIX (Unix-like) systems, allowing developers to write code that works seamlessly across different environments. This package is particularly useful for file path manipulation, construction, and normalization.

What are ospath's main functionalities?

Home Directory

Retrieves the current user's home directory in a cross-platform way.

const ospath = require('ospath');
console.log(ospath.home());

Temporary Directory

Provides the path to the system's temporary directory, which is useful for storing temporary files.

const ospath = require('ospath');
console.log(ospath.tmp());

Data Directory

Gets the path to the system's data directory where applications can store application-specific data.

const ospath = require('ospath');
console.log(ospath.data());

Other packages similar to ospath

Readme

Source

ospath

npm Package build status

A JavaScript component that provides operating specific path values.

Installation

npm i --save ospath

API

ospath.data()

Returns the directory where an application should store its data directory.

  • Windows: %APPDATA%
  • OS X: ~/Library/Application Support
  • Unix-like: $XDG_CONFIG_HOME or ~/.config

ospath.desktop()

Returns the users desktop directory. On every OS, this is just the home() dir and Desktop.

ospath.home()

Returns the user's home directory.

  • Windows: %USERPROFILE%
  • Unix-like: $HOME

ospath.tmp()

Returns a temporary directory. Could also use require('os').tmpdir().

  • Windows: %TEMP%
  • Unix-like: /tmp

License

MIT

Keywords

FAQs

Last updated on 07 Sep 2016

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