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.4.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, temp, ...)

Build status Build status Build status Coverage status License 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:\Windows\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 which are normalized and have no trailing path separators.

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

Discussion

XDG

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

Building and Contributing

Build requirements

  • NodeJS >= 6.0
  • a JavaScript package/project manager (npm or yarn)
optional

Build/test

npm install
npm test

Project development scripts

> npm run help
...
usage: `npm run TARGET [TARGET..]`

TARGETs:

coverage            calculate and display (or send) code coverage [alias: 'cov']
fix                 fix package issues (automated/non-interactive)
fix:lint            fix `ESLint` issues
fix:style           fix `Prettier` formatting issues
help                display help
lint                check for package code 'lint'
lint:lint           check for code 'lint' (using `ESLint`)
lint:spell          check for spelling errors (using `cSpell`)
lint:style          check for format imperfections (using `Prettier`)
lint:types          check for type declaration errors (using `tsd`)
test                test package
test:code           test package code
update:changelog    update CHANGELOG (using `git changelog ...`)

Contributions

Contributions are welcome.

Any pull requests should be based off of the default branch (master). And, whenever possible, please include tests for any new code, ensuring that local (via npm test) and remote CI testing passes.

By contributing to the project, you are agreeing to provide your contributions under the same license as the project itself.

License

MIT © Roy Ivy III, Sindre Sorhus

Keywords

FAQs

Package last updated on 16 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