Resolve an absolute file path from local directories, local node_modules or global node_modules.
Install with npm:
$ npm install --save resolve-file
var resolveFile = require('resolve-file');
Resolve the path to a file located in one of the following places:
'./index.js')'/usr/something.rc')'cwd')'cwd/LICENSE')'~/.npmrc')Example
var fp = resolve('./index.js')
//=> /path/to/resolve-file/index.js
Params
name {String}: Filename to resolveoptions {Object}: Additional options to specify cwdreturns {String}: Resolved filepath if foundResolve the path to a file located in one of the following places:
'./index.js')'/usr/something.rc')'cwd')'cwd/LICENSE')'~/.npmrc')Example
var file = resolve.file('./index.js')
//=> {
//=> cwd: '/path/to/resolve-file',
//=> path: '/path/to/resolve-file/index.js'
//=> }
Params
name {String}: Filename to resolveoptions {Object}: Additional options to specify cwdreturns {Object}: File object with resolved path if found.Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
| Commits | Contributor |
|---|---|
| 13 | doowb |
| 7 | jonschlinkert |
(This document was generated by verb-generate-readme (a verb generator), please don't edit the readme directly. Any changes to the readme must be made in .verb.md.)
To generate the readme and API documentation with verb:
$ npm install -g verb verb-generate-readme && verb
Install dev dependencies:
$ npm install -d && npm test
Brian Woodward
Copyright © 2016, Brian Woodward. Released under the MIT license.
This file was generated by verb-generate-readme, v0.2.0, on October 19, 2016.