Check if a file is available globally in PATH
Useful when you need to check if a file (script, executable, etc.) is callable globally.
$ npm install --save is-file-global
var isFileGlobal = require('is-file-global');
isFileGlobal('where.exe', function(err, path) {
if (err) {
throw err;
}
console.log(path);
//=> C:/Windows/system32/where.exe
});
Required
Type: string
Name of a script or executable to find e.g. where.exe
. Also, you can use patterns to match files, see Glob.
Required
Type: function
Arguments: error
, string
Resulting string contains location of the file if found, undefined
otherwise.
This module was tested on Windows only.
MIT © Peter Sandor