Ohm-Management - Projektarbeit B-ME
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.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. # isexe
  2. Minimal module to check if a file is executable, and a normal file.
  3. Uses `fs.stat` and tests against the `PATHEXT` environment variable on
  4. Windows.
  5. ## USAGE
  6. ```javascript
  7. var isexe = require('isexe')
  8. isexe('some-file-name', function (err, isExe) {
  9. if (err) {
  10. console.error('probably file does not exist or something', err)
  11. } else if (isExe) {
  12. console.error('this thing can be run')
  13. } else {
  14. console.error('cannot be run')
  15. }
  16. })
  17. // same thing but synchronous, throws errors
  18. var isExe = isexe.sync('some-file-name')
  19. // treat errors as just "not executable"
  20. isexe('maybe-missing-file', { ignoreErrors: true }, callback)
  21. var isExe = isexe.sync('maybe-missing-file', { ignoreErrors: true })
  22. ```
  23. ## API
  24. ### `isexe(path, [options], [callback])`
  25. Check if the path is executable. If no callback provided, and a
  26. global `Promise` object is available, then a Promise will be returned.
  27. Will raise whatever errors may be raised by `fs.stat`, unless
  28. `options.ignoreErrors` is set to true.
  29. ### `isexe.sync(path, [options])`
  30. Same as `isexe` but returns the value and throws any errors raised.
  31. ### Options
  32. * `ignoreErrors` Treat all errors as "no, this is not executable", but
  33. don't raise them.
  34. * `uid` Number to use as the user id
  35. * `gid` Number to use as the group id
  36. * `pathExt` List of path extensions to use instead of `PATHEXT`
  37. environment variable on Windows.