1.0.0 • Published 9 years ago
multiwhich v1.0.0
multiwhich
node-which with multi-executable support: finds the first instance of a specified executable in the PATH environment variable.
const multiwhich = require('multiwhich');
multiwhich(['ls', 'mkdir'], (err, paths) {
if (err) {
throw err;
}
paths; ['/bin/ls', '/bin/mkdir']
});
Installation
npm install multiwhich
API
const multiwhich = require('multiwhich');
multiwhich(cmds , options, callback)
cmds: Array
of strings
options: Object
(used as node-which options)
callback: Function
The API is almost the same as node-which
's, except for:
- It receives an array of executable names as its first argument.
- It passes an array of the resolved executable paths to the callback function.
const multiwhich = require('multiwhich');
multiwhich(['eslint', 'tape'], {path: 'node_modules/.bin/'}, (err, paths) => {
if (err) {
throw err;
}
paths:
//=> ['/Users/yourname/project/node_modules/.bin/eslint', '/Users/yourname/project/node_modules/.bin/eslint']
});
License
Copyright (c) 2015 Shinnosuke Watanabe
Licensed under the MIT License.