# manage-path

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

Latest version **2.0.0** (published 2015-10-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install manage-path
pnpm add manage-path
yarn add manage-path
bun add manage-path
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2015-10-21 |
| First published | 2015-10-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Kent C. Dodds |
| Maintainers | kentcdodds |
| Keywords | path, cross-platform |

## Links

- npm: https://www.npmjs.com/package/manage-path
- Repository: https://github.com/kentcdodds/node-manage-path
- Homepage: https://github.com/kentcdodds/node-manage-path#readme
- Issues: https://github.com/kentcdodds/node-manage-path/issues
- npm.io page: https://npm.io/package/manage-path

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 2.0.0 (latest) — 2015-10-21
- 1.0.1 — 2015-10-21
- 1.0.0 — 2015-10-21

## README

# manage-path

Status:
[![npm version](https://img.shields.io/npm/v/manage-path.svg?style=flat-square)](https://www.npmjs.org/package/manage-path)
[![npm downloads](https://img.shields.io/npm/dm/manage-path.svg?style=flat-square)](http://npm-stat.com/charts.html?package=manage-path&from=2015-09-01)
[![Build Status](https://img.shields.io/travis/kentcdodds/node-manage-path.svg?style=flat-square)](https://travis-ci.org/kentcdodds/node-manage-path)
[![Code Coverage](https://img.shields.io/codecov/c/github/kentcdodds/node-manage-path.svg?style=flat-square)](https://codecov.io/github/kentcdodds/node-manage-path)

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

## Main Usage

```javascript
var path = require('path')
var managePath = require('manage-path')
var alterPath = managePath(process.env)
alterPath.shift(path.join(process.cwd(), 'node_modules', '.bin') // add one path to the beginning
// 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...

alterPath.push('~/custombin', '/usr/other/bin') // add multiple paths to the end
alterPath.push(['~/foo/bar', '/bar/foo/bin']) // array-style multi-path add for ultimate flexibility :-)

// need to get the path value cross-platform?
alterPath.get() // <-- returns value of PATH or Path... depending :-)

// want to restore the path to what it was before you mucked with it?
// just call the function you get back:
alterPath.restore()
```

## options

These are options you pass as an object to `managePath`

### 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.

# Other info

LICENSE -> MIT

Much of the original code for this came from [npm/npm](https://github.com/npm/npm)

---
_Source: https://npm.io/package/manage-path · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
