# resolve-dir

> Resolve a directory that is either local, global or in the user's home directory.

Latest version **1.0.1** (published 2017-08-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install resolve-dir
pnpm add resolve-dir
yarn add resolve-dir
bun add resolve-dir
```

## Health

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

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2017-08-05 |
| First published | 2015-09-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/resolve-dir) |
| Module format | CommonJS |
| Node | >=0.10.0 |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 14 |
| Author | Jon Schlinkert |
| Maintainers | phated, jonschlinkert |
| Keywords | dir, directory, expansion, file, filepath, fp, global, home, modules, npm, path, resolve, tilde, user, user-home, userhome |

## Links

- npm: https://www.npmjs.com/package/resolve-dir
- Repository: https://github.com/jonschlinkert/resolve-dir
- Issues: https://github.com/jonschlinkert/resolve-dir/issues
- npm.io page: https://npm.io/package/resolve-dir

## Dependencies (2)

- [expand-tilde](https://npm.io/package/expand-tilde.md) ^2.0.0
- [global-modules](https://npm.io/package/global-modules.md) ^1.0.0

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

- 1.0.1 (latest) — 2017-08-05
- 1.0.0 — 2016-10-18
- 0.1.1 — 2016-07-29
- 0.1.0 — 2015-09-21

## README

# resolve-dir [![NPM version](https://img.shields.io/npm/v/resolve-dir.svg?style=flat)](https://www.npmjs.com/package/resolve-dir) [![NPM downloads](https://img.shields.io/npm/dm/resolve-dir.svg?style=flat)](https://npmjs.org/package/resolve-dir) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/resolve-dir.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/resolve-dir)

> Resolve a directory that is either local, global or in the user's home directory.

## Install

Install with [npm](https://www.npmjs.com/):

```sh
$ npm install --save resolve-dir
```

## Usage

```js
var resolve = require('resolve-dir');
```

Returns a local directory path unchanged

```js
resolve('a')
//=> 'a'
```

Resolves the path to user home

```js
resolve('~')
//=> '/Users/jonschlinkert'
resolve('~/foo')
//=> '/Users/jonschlinkert/foo'
```

Resolves the path to global npm modules

```js
resolve('@')
//=> '/usr/local/lib/node_modules'
resolve('@/foo')
//=> '/usr/local/lib/node_modules/foo'
```

## About

### Related projects

* [expand-tilde](https://www.npmjs.com/package/expand-tilde): Bash-like tilde expansion for node.js. Expands a leading tilde in a file path to the… [more](https://github.com/jonschlinkert/expand-tilde) | [homepage](https://github.com/jonschlinkert/expand-tilde "Bash-like tilde expansion for node.js. Expands a leading tilde in a file path to the user home directory, or `~+` to the cwd.")
* [findup-sync](https://www.npmjs.com/package/findup-sync): Find the first file matching a given pattern in the current directory or the nearest… [more](https://github.com/cowboy/node-findup-sync) | [homepage](https://github.com/cowboy/node-findup-sync "Find the first file matching a given pattern in the current directory or the nearest ancestor directory.")
* [resolve-modules](https://www.npmjs.com/package/resolve-modules): Resolves local and global npm modules that match specified patterns, and returns a configuration object… [more](https://github.com/jonschlinkert/resolve-modules) | [homepage](https://github.com/jonschlinkert/resolve-modules "Resolves local and global npm modules that match specified patterns, and returns a configuration object for each resolved module.")

### Contributing

Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).

### Building docs

_(This document was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme) (a [verb](https://github.com/verbose/verb) generator), please don't edit the readme directly. Any changes to the readme must be made in [.verb.md](.verb.md).)_

To generate the readme and API documentation with [verb](https://github.com/verbose/verb):

```sh
$ npm install -g verb verb-generate-readme && verb
```

### Running tests

Install dev dependencies:

```sh
$ npm install -d && npm test
```

### Author

**Jon Schlinkert**

* [github/jonschlinkert](https://github.com/jonschlinkert)
* [twitter/jonschlinkert](http://twitter.com/jonschlinkert)

### License

Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert).
Released under the [MIT license](https://github.com/jonschlinkert/resolve-dir/blob/master/LICENSE).

***

_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.2.0, on October 18, 2016._

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