You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

readme.md 1.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. # executable [![Build Status](https://travis-ci.org/kevva/executable.svg?branch=master)](https://travis-ci.org/kevva/executable)
  2. > Check if a file is executable
  3. ## Install
  4. ```
  5. $ npm install --save executable
  6. ```
  7. ## Usage
  8. ```js
  9. const executable = require('executable');
  10. executable('bash').then(exec => {
  11. console.log(exec);
  12. //=> true
  13. });
  14. ```
  15. ## API
  16. ### executable(file)
  17. Returns a Promise for a boolean.
  18. ### executable.sync(file)
  19. Returns a boolean of whether the file is executable.
  20. #### file
  21. Type: `string`
  22. Path of the file.
  23. ### executable.checkMode(mode, [gid], [uid])
  24. Returns a boolean of whether the mode passed as first argument means that the file is executable.
  25. #### mode
  26. Type: `number`
  27. Property `mode` of `fs.Stats` instance returned by `fs.stat()` (or `fs.statSync()`) function.
  28. #### gid, uid
  29. Type: `number`
  30. 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.
  31. ## Related
  32. * [executable-cli](https://github.com/kevva/executable-cli) - CLI for this module
  33. ## License
  34. MIT © [Kevin Mårtensson](https://github.com/kevva)