3 Minimal module to check if a file is executable.
5 Uses `fs.access` if available, and tests against the `PATHEXT`
6 environment variable on Windows.
11 var isexe = require('isexe')
12 isexe('some-file-name', function (err, isExe) {
14 console.error('probably file does not exist or something', err)
16 console.error('this thing can be run')
18 console.error('cannot be run')
22 // same thing but synchronous, throws errors
23 var isExe = isexe.sync('some-file-name')
25 // treat errors as just "not executable"
26 isexe('maybe-missing-file', { ignoreErrors: true }, callback)
27 var isExe = isexe.sync('maybe-missing-file', { ignoreErrors: true })
32 ### `isexe(path, [options], [callback])`
34 Check if the path is executable. If no callback provided, and a
35 global `Promise` object is available, then a Promise will be returned.
37 Will raise whatever errors may be raised by `fs.access` or `fs.stat`,
38 unless `options.ignoreErrors` is set to true.
40 ### `isexe.sync(path, [options])`
42 Same as `isexe` but returns the value and throws any errors raised.
46 * `ignoreErrors` Treat all errors as "no, this is not executable", but
48 * `uid` Number to use as the user id when using the `mode` approach.
49 * `gid` Number to use as the group id when using the `mode` approach.
50 * `pathExt` List of path extensions to use instead of `PATHEXT`
51 environment variable on Windows.