Socket
Socket
Sign inDemoInstall

add-to-path

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

add-to-path

Cross-platform method to add a directory to your $PATH


Version published
Weekly downloads
25
increased by13.64%
Maintainers
1
Weekly downloads
 
Created
Source

add-to-path

Status: npm version npm downloads Build Status Code Coverage

This micro-lib allows you to alter the $PATH in a cross-platform way.

Main Usage

var path = require('path');
var addToPath = require('add-to-path');
var restorePath = addToPath(path.join(process.cwd(), 'node_modules', '.bin'));
// process.env.PATH now starts with the `.bin` in your `node_modules` directory :-)
// unless you happen to be running on windows, in which case it *might* be process.env.Path :-)
// but you don't have to think about that...
// want to restore the path to what it was before you mucked with it?
// just call the function you get back:
restorePath();

// wanna add several paths at once? Done!
addToPath(['/foo/bar/.bin', '/bar/foo/.bin']);

options

platform

Allows you to specify your own platform. Defaults to process.platform. Currently the only meaningful value is 'win32'. This option is mainly available for testing purposes.

append

Defaults to undefined, but when set to true will add the directory you pass to the end (rather than the beginning).

Other info

LICENSE -> MIT

Much of the original code for this came from npm/npm

Keywords

FAQs

Package last updated on 26 Sep 2015

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