real-executable-path-callback

3.0.0 • Public • Published

real-executable-path-callback

npm version Build Status Build status Coverage Status

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

Use npm.

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

License

ISC License © 2017 Shinnosuke Watanabe

Package Sidebar

Install

npm i real-executable-path-callback

Weekly Downloads

51

Version

3.0.0

License

ISC

Last publish

Collaborators

  • shinnn