real-executable-path

Find the first instance of an executable in the PATH, with expanding all symbolic links


Keywords
real, realpath, path, bin, binary, exe, executable, find, resolve, promise, promises, then, async, asynchronous, asynchronously, javascript, nodejs, symbolic-links, symlink
License
ISC
Install
npm install real-executable-path@3.0.0

Documentation

real-executable-path

npm version Build Status Build status Coverage Status

Find the first instance of an executable in the PATH, with expanding all symbolic links

const realExecutablePath = require('real-executable-path');
const which = require('which');

which('npm', (err, binPath) => {
  binPath; //=> '/usr/local/bin/npm'
});

realExecutablePath('npm').then(binPath => {
  binPath; //=> '/usr/local/lib/node_modules/npm/bin/npm-cli.js'
});

Installation

Use npm.

npm install real-executable-path

API

const realExecutablePath = require('real-executable-path');

realExecutablePath(binName [, options])

binName: string (an executable name in the PATH)
options: Object (node-which options except for all)
Return: Promise<string>

It finds the first instance of the given executable in the PATH environment variable, expands all symbolic links and resolves the canonicalized absolute pathname.

Related projects

License

ISC License © 2017 - 2018 Shinnosuke Watanabe