údržba
This commit is contained in:
		
							
								
								
									
										36
									
								
								CyLukTs/lukan/node_modules/executable/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								CyLukTs/lukan/node_modules/executable/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,36 @@
 | 
			
		||||
'use strict';
 | 
			
		||||
const fs = require('fs');
 | 
			
		||||
const pify = require('pify');
 | 
			
		||||
 | 
			
		||||
const isExe = (mode, gid, uid) => {
 | 
			
		||||
	if (process.platform === 'win32') {
 | 
			
		||||
		return true;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	const isGroup = gid ? process.getgid && gid === process.getgid() : true;
 | 
			
		||||
	const isUser = uid ? process.getuid && uid === process.getuid() : true;
 | 
			
		||||
 | 
			
		||||
	return Boolean((mode & 0o0001) ||
 | 
			
		||||
		((mode & 0o0010) && isGroup) ||
 | 
			
		||||
		((mode & 0o0100) && isUser));
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
module.exports = name => {
 | 
			
		||||
	if (typeof name !== 'string') {
 | 
			
		||||
		return Promise.reject(new TypeError('Expected a string'));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return pify(fs.stat)(name).then(stats => stats && stats.isFile() && isExe(stats.mode, stats.gid, stats.uid));
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
module.exports.sync = name => {
 | 
			
		||||
	if (typeof name !== 'string') {
 | 
			
		||||
		throw new TypeError('Expected a string');
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	const stats = fs.statSync(name);
 | 
			
		||||
 | 
			
		||||
	return stats && stats.isFile() && isExe(stats.mode, stats.gid, stats.uid);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
module.exports.checkMode = isExe;
 | 
			
		||||
							
								
								
									
										21
									
								
								CyLukTs/lukan/node_modules/executable/license
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								CyLukTs/lukan/node_modules/executable/license
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
			
		||||
The MIT License (MIT)
 | 
			
		||||
 | 
			
		||||
Copyright (c) Kevin Mårtensson <kevinmartensson@gmail.com>
 | 
			
		||||
 | 
			
		||||
Permission is hereby granted, free of charge, to any person obtaining a copy
 | 
			
		||||
of this software and associated documentation files (the "Software"), to deal
 | 
			
		||||
in the Software without restriction, including without limitation the rights
 | 
			
		||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 | 
			
		||||
copies of the Software, and to permit persons to whom the Software is
 | 
			
		||||
furnished to do so, subject to the following conditions:
 | 
			
		||||
 | 
			
		||||
The above copyright notice and this permission notice shall be included in
 | 
			
		||||
all copies or substantial portions of the Software.
 | 
			
		||||
 | 
			
		||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 | 
			
		||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 | 
			
		||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 | 
			
		||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 | 
			
		||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 | 
			
		||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 | 
			
		||||
THE SOFTWARE.
 | 
			
		||||
							
								
								
									
										36
									
								
								CyLukTs/lukan/node_modules/executable/package.json
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								CyLukTs/lukan/node_modules/executable/package.json
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,36 @@
 | 
			
		||||
{
 | 
			
		||||
  "name": "executable",
 | 
			
		||||
  "version": "4.1.1",
 | 
			
		||||
  "description": "Check if a file is executable",
 | 
			
		||||
  "license": "MIT",
 | 
			
		||||
  "repository": "kevva/executable",
 | 
			
		||||
  "author": {
 | 
			
		||||
    "name": "Kevin Mårtensson",
 | 
			
		||||
    "email": "kevinmartensson@gmail.com",
 | 
			
		||||
    "url": "https://github.com/kevva"
 | 
			
		||||
  },
 | 
			
		||||
  "engines": {
 | 
			
		||||
    "node": ">=4"
 | 
			
		||||
  },
 | 
			
		||||
  "scripts": {
 | 
			
		||||
    "test": "xo && ava"
 | 
			
		||||
  },
 | 
			
		||||
  "files": [
 | 
			
		||||
    "index.js"
 | 
			
		||||
  ],
 | 
			
		||||
  "keywords": [
 | 
			
		||||
    "exec",
 | 
			
		||||
    "executable",
 | 
			
		||||
    "permission"
 | 
			
		||||
  ],
 | 
			
		||||
  "dependencies": {
 | 
			
		||||
    "pify": "^2.2.0"
 | 
			
		||||
  },
 | 
			
		||||
  "devDependencies": {
 | 
			
		||||
    "ava": "*",
 | 
			
		||||
    "xo": "*"
 | 
			
		||||
  },
 | 
			
		||||
  "xo": {
 | 
			
		||||
    "esnext": true
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										64
									
								
								CyLukTs/lukan/node_modules/executable/readme.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										64
									
								
								CyLukTs/lukan/node_modules/executable/readme.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,64 @@
 | 
			
		||||
# executable [](https://travis-ci.org/kevva/executable)
 | 
			
		||||
 | 
			
		||||
> Check if a file is executable
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## Install
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
$ npm install --save executable
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## Usage
 | 
			
		||||
 | 
			
		||||
```js
 | 
			
		||||
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](https://github.com/kevva/executable-cli) - CLI for this module
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## License
 | 
			
		||||
 | 
			
		||||
MIT © [Kevin Mårtensson](https://github.com/kevva)
 | 
			
		||||
		Reference in New Issue
	
	Block a user