executable ![Build Status](https://camo.githubusercontent.com/e52d1360637001293e5f3e23fac5808e8bb9b691b0d163804a7bf60947e03a2c/68747470733a2f2f7472617669732d63692e6f72672f6b657676612f65786563757461626c652e7376673f6272616e63683d6d6173746572)
Check if a file is executable
Install
$ npm install --save executable
Usage
const executable = require('executable');
executable('bash').then(exec => {
console.log(exec);
//=> true
});
API
executable(file)
Returns a Promise for a boolean.
executable.sync(file)
Returns a boolean of whether the file is executable.
file
Type: string
Path of the file.
executable.checkMode(mode, [gid], [uid])
Returns a boolean of whether the mode passed as first argument means that the file is executable.
mode
Type: number
Property mode
of fs.Stats
instance returned by fs.stat()
(or fs.statSync()
) function.
gid, uid
Type: number
Respectively the group identity and user identity of the file. If not set, permissions will be evaluated without considering owner or group of the file.
Related
- executable-cli - CLI for this module
License
MIT © Kevin Mårtensson