real-executable-path-callback
Callback-style version of real-executable-path:
Find the first instance of an executable in the PATH, with expanding all symbolic links
const realExecutablePathCallback = require('real-executable-path-callback');
const which = require('which');
which('npm', (err, binPath) => {
binPath; //=> '/usr/local/bin/npm'
});
realExecutablePathCallback('npm', (err, binPath) => {
binPath; //=> '/usr/local/lib/node_modules/npm/bin/npm-cli.js'
});
Installation
npm install real-executable-path-callback
API
const realExecutablePathCallback = require('real-executable-path-callback');
realExecutablePathCallback(binName [, options], callback)
binName: string
(an executable name in the PATH)
options: Object
(node-which
options except for all
)
callback: Function
(called after the path is resolved)
It finds the first instance of the given executable in the PATH environment variable, expands all symbolic links and resolves the canonicalized absolute pathname.
const realExecutablePathCallback = require('real-executable-path-callback');
realExecutablePathCallback('this_cmd_is_not_installed', err => {
err.message; //=> 'not found: this_cmd_is_not_installed'
err.code; //=> 'ENOENT'
});
Related project
- real-executable-path — Promise version
License
ISC License © 2017 Shinnosuke Watanabe