# resolve-file

> Resolve an absolute file path from local directories, local node_modules or global node_modules.

Latest version **0.3.0** (published 2016-12-31) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.0 |
| Published | 2016-12-31 |
| First published | 2015-08-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.10.0 |
| Dependencies | 7 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | Brian Woodward |
| Maintainers | doowb, jonschlinkert |
| Keywords | file, resolve |

## Links

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

## Dependencies (7)

- [cwd](https://npm.io/package/cwd.md) ^0.10.0
- [resolve](https://npm.io/package/resolve.md) ^1.2.0
- [lazy-cache](https://npm.io/package/lazy-cache.md) ^2.0.2
- [expand-tilde](https://npm.io/package/expand-tilde.md) ^2.0.2
- [extend-shallow](https://npm.io/package/extend-shallow.md) ^2.0.1
- [fs-exists-sync](https://npm.io/package/fs-exists-sync.md) ^0.1.0
- [homedir-polyfill](https://npm.io/package/homedir-polyfill.md) ^1.0.1

## Alternatives

- [unionfs](https://npm.io/package/unionfs.md) — 2.2M weekly downloads
- [path-starts-with](https://npm.io/package/path-starts-with.md) — 35.9K weekly downloads
- [redzip](https://npm.io/package/redzip.md) — 1.2K weekly downloads
- [vscode-anymatch](https://npm.io/package/vscode-anymatch.md) — 848 weekly downloads
- [@ledgerhq/coin-filecoin](https://npm.io/package/@ledgerhq/coin-filecoin.md) — 793 weekly downloads

## Recent versions

- 0.3.0 (latest) — 2016-12-31
- 0.2.2 — 2016-10-19
- 0.2.1 — 2016-08-17
- 0.2.0 — 2016-06-06
- 0.1.0 — 2015-08-01

## README

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

> Resolve an absolute file path from local directories, local node_modules or global node_modules.

## Install

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

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

## Usage

```js
var resolveFile = require('resolve-file');
```

## API

### [resolve](index.js#L33)

Resolve the path to a file located in one of the following places:

* local to the current project (`'./index.js'`)
* absolute (`'/usr/something.rc'`)
* node module "main" file (`'cwd'`)
* specific file inside a node module (`'cwd/LICENSE'`)
* file located in user's home directory (`'~/.npmrc'`)

**Example**

```js
var fp = resolve('./index.js')
//=> /path/to/resolve-file/index.js
```

**Params**

* `name` **{String}**: Filename to resolve
* `options` **{Object}**: Additional options to specify `cwd`
* `returns` **{String}**: Resolved `filepath` if found

### [.file](index.js#L61)

Resolve the path to a file located in one of the following places:

* local to the current project (`'./index.js'`)
* absolute (`'/usr/something.rc'`)
* node module "main" file (`'cwd'`)
* specific file inside a node module (`'cwd/LICENSE'`)
* file located in user's home directory (`'~/.npmrc'`)

**Example**

```js
var file = resolve.file('./index.js')
//=> {
//=>   cwd: '/path/to/resolve-file',
//=>   path: '/path/to/resolve-file/index.js'
//=> }
```

**Params**

* `name` **{String}**: Filename to resolve
* `options` **{Object}**: Additional options to specify `cwd`
* `returns` **{Object}**: File object with resolved `path` if found.

## About

### Related projects

* [cwd](https://www.npmjs.com/package/cwd): Easily get the CWD (current working directory) of a project based on package.json, optionally starting… [more](https://github.com/jonschlinkert/cwd) | [homepage](https://github.com/jonschlinkert/cwd "Easily get the CWD (current working directory) of a project based on package.json, optionally starting from a given path. (node.js/javascript util)")
* [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.")
* [look-up](https://www.npmjs.com/package/look-up): Faster drop-in replacement for find-up and findup-sync. | [homepage](https://github.com/jonschlinkert/look-up "Faster drop-in replacement for find-up and findup-sync.")
* [resolve](https://www.npmjs.com/package/resolve): resolve like require.resolve() on behalf of files asynchronously and synchronously | [homepage](https://github.com/substack/node-resolve#readme "resolve like require.resolve() on behalf of files asynchronously and synchronously")

### Contributing

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

### Contributors

| **Commits** | **Contributor**<br/> | 
| --- | --- |
| 13 | [doowb](https://github.com/doowb) |
| 7 | [jonschlinkert](https://github.com/jonschlinkert) |

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

**Brian Woodward**

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

### License

Copyright © 2016, [Brian Woodward](https://github.com/doowb).
Released under the [MIT license](LICENSE).

***

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

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