Galerie und tage
This commit is contained in:
30
node_modules/executable/cli.js
generated
vendored
Executable file
30
node_modules/executable/cli.js
generated
vendored
Executable file
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
|
||||
var meow = require('meow');
|
||||
var executable = require('./');
|
||||
|
||||
var cli = meow({
|
||||
help: [
|
||||
'Usage',
|
||||
' $ executable <file>',
|
||||
'',
|
||||
'Example',
|
||||
' $ executable optipng'
|
||||
].join('\n')
|
||||
});
|
||||
|
||||
if (!cli.input.length) {
|
||||
console.error('Filename required');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
executable(cli.input[0], function (err, exec) {
|
||||
if (err) {
|
||||
console.error(err.message);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
console.log(exec ? 'true' : 'false');
|
||||
process.exit(exec ? 0 : 1);
|
||||
});
|
||||
49
node_modules/executable/index.js
generated
vendored
49
node_modules/executable/index.js
generated
vendored
@@ -1,36 +1,47 @@
|
||||
'use strict';
|
||||
const fs = require('fs');
|
||||
const pify = require('pify');
|
||||
|
||||
const isExe = (mode, gid, uid) => {
|
||||
var fs = require('fs');
|
||||
|
||||
function 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 (mode & parseInt('0001', 8)) ||
|
||||
(mode & parseInt('0010', 8)) && process.getgid && gid === process.getgid() ||
|
||||
(mode & parseInt('0100', 8)) && process.getuid && uid === process.getuid();
|
||||
}
|
||||
|
||||
return Boolean((mode & 0o0001) ||
|
||||
((mode & 0o0010) && isGroup) ||
|
||||
((mode & 0o0100) && isUser));
|
||||
};
|
||||
|
||||
module.exports = name => {
|
||||
module.exports = function (name, cb) {
|
||||
if (typeof name !== 'string') {
|
||||
return Promise.reject(new TypeError('Expected a string'));
|
||||
throw new Error('Filename required');
|
||||
}
|
||||
|
||||
return pify(fs.stat)(name).then(stats => stats && stats.isFile() && isExe(stats.mode, stats.gid, stats.uid));
|
||||
fs.stat(name, function (err, stats) {
|
||||
if (err) {
|
||||
cb(err);
|
||||
return;
|
||||
}
|
||||
|
||||
if (stats && stats.isFile() && isExe(stats.mode, stats.gid, stats.uid)) {
|
||||
cb(null, true);
|
||||
return;
|
||||
}
|
||||
|
||||
cb(null, false);
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.sync = name => {
|
||||
module.exports.sync = function (name) {
|
||||
if (typeof name !== 'string') {
|
||||
throw new TypeError('Expected a string');
|
||||
throw new Error('Filename required');
|
||||
}
|
||||
|
||||
const stats = fs.statSync(name);
|
||||
var file = fs.statSync(name);
|
||||
|
||||
return stats && stats.isFile() && isExe(stats.mode, stats.gid, stats.uid);
|
||||
if (file && file.isFile() && isExe(file.mode, file.gid, file.uid)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
module.exports.checkMode = isExe;
|
||||
|
||||
68
node_modules/executable/node_modules/pify/index.js
generated
vendored
68
node_modules/executable/node_modules/pify/index.js
generated
vendored
@@ -1,68 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
var processFn = function (fn, P, opts) {
|
||||
return function () {
|
||||
var that = this;
|
||||
var args = new Array(arguments.length);
|
||||
|
||||
for (var i = 0; i < arguments.length; i++) {
|
||||
args[i] = arguments[i];
|
||||
}
|
||||
|
||||
return new P(function (resolve, reject) {
|
||||
args.push(function (err, result) {
|
||||
if (err) {
|
||||
reject(err);
|
||||
} else if (opts.multiArgs) {
|
||||
var results = new Array(arguments.length - 1);
|
||||
|
||||
for (var i = 1; i < arguments.length; i++) {
|
||||
results[i - 1] = arguments[i];
|
||||
}
|
||||
|
||||
resolve(results);
|
||||
} else {
|
||||
resolve(result);
|
||||
}
|
||||
});
|
||||
|
||||
fn.apply(that, args);
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
var pify = module.exports = function (obj, P, opts) {
|
||||
if (typeof P !== 'function') {
|
||||
opts = P;
|
||||
P = Promise;
|
||||
}
|
||||
|
||||
opts = opts || {};
|
||||
opts.exclude = opts.exclude || [/.+Sync$/];
|
||||
|
||||
var filter = function (key) {
|
||||
var match = function (pattern) {
|
||||
return typeof pattern === 'string' ? key === pattern : pattern.test(key);
|
||||
};
|
||||
|
||||
return opts.include ? opts.include.some(match) : !opts.exclude.some(match);
|
||||
};
|
||||
|
||||
var ret = typeof obj === 'function' ? function () {
|
||||
if (opts.excludeMain) {
|
||||
return obj.apply(this, arguments);
|
||||
}
|
||||
|
||||
return processFn(obj, P, opts).apply(this, arguments);
|
||||
} : {};
|
||||
|
||||
return Object.keys(obj).reduce(function (ret, key) {
|
||||
var x = obj[key];
|
||||
|
||||
ret[key] = typeof x === 'function' && filter(key) ? processFn(x, P, opts) : x;
|
||||
|
||||
return ret;
|
||||
}, ret);
|
||||
};
|
||||
|
||||
pify.all = pify;
|
||||
21
node_modules/executable/node_modules/pify/license
generated
vendored
21
node_modules/executable/node_modules/pify/license
generated
vendored
@@ -1,21 +0,0 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.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.
|
||||
48
node_modules/executable/node_modules/pify/package.json
generated
vendored
48
node_modules/executable/node_modules/pify/package.json
generated
vendored
@@ -1,48 +0,0 @@
|
||||
{
|
||||
"name": "pify",
|
||||
"version": "2.3.0",
|
||||
"description": "Promisify a callback-style function",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/pify",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && npm run optimization-test",
|
||||
"optimization-test": "node --allow-natives-syntax optimization-test.js"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"promise",
|
||||
"promises",
|
||||
"promisify",
|
||||
"denodify",
|
||||
"denodeify",
|
||||
"callback",
|
||||
"cb",
|
||||
"node",
|
||||
"then",
|
||||
"thenify",
|
||||
"convert",
|
||||
"transform",
|
||||
"wrap",
|
||||
"wrapper",
|
||||
"bind",
|
||||
"to",
|
||||
"async",
|
||||
"es2015"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"pinkie-promise": "^1.0.0",
|
||||
"v8-natives": "0.0.2",
|
||||
"xo": "*"
|
||||
}
|
||||
}
|
||||
119
node_modules/executable/node_modules/pify/readme.md
generated
vendored
119
node_modules/executable/node_modules/pify/readme.md
generated
vendored
@@ -1,119 +0,0 @@
|
||||
# pify [](https://travis-ci.org/sindresorhus/pify)
|
||||
|
||||
> Promisify a callback-style function
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save pify
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const fs = require('fs');
|
||||
const pify = require('pify');
|
||||
|
||||
// promisify a single function
|
||||
|
||||
pify(fs.readFile)('package.json', 'utf8').then(data => {
|
||||
console.log(JSON.parse(data).name);
|
||||
//=> 'pify'
|
||||
});
|
||||
|
||||
// or promisify all methods in a module
|
||||
|
||||
pify(fs).readFile('package.json', 'utf8').then(data => {
|
||||
console.log(JSON.parse(data).name);
|
||||
//=> 'pify'
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### pify(input, [promiseModule], [options])
|
||||
|
||||
Returns a promise wrapped version of the supplied function or module.
|
||||
|
||||
#### input
|
||||
|
||||
Type: `function`, `object`
|
||||
|
||||
Callback-style function or module whose methods you want to promisify.
|
||||
|
||||
#### promiseModule
|
||||
|
||||
Type: `function`
|
||||
|
||||
Custom promise module to use instead of the native one.
|
||||
|
||||
Check out [`pinkie-promise`](https://github.com/floatdrop/pinkie-promise) if you need a tiny promise polyfill.
|
||||
|
||||
#### options
|
||||
|
||||
##### multiArgs
|
||||
|
||||
Type: `boolean`
|
||||
Default: `false`
|
||||
|
||||
By default, the promisified function will only return the second argument from the callback, which works fine for most APIs. This option can be useful for modules like `request` that return multiple arguments. Turning this on will make it return an array of all arguments from the callback, excluding the error argument, instead of just the second argument.
|
||||
|
||||
```js
|
||||
const request = require('request');
|
||||
const pify = require('pify');
|
||||
|
||||
pify(request, {multiArgs: true})('https://sindresorhus.com').then(result => {
|
||||
const [httpResponse, body] = result;
|
||||
});
|
||||
```
|
||||
|
||||
##### include
|
||||
|
||||
Type: `array` of (`string`|`regex`)
|
||||
|
||||
Methods in a module to promisify. Remaining methods will be left untouched.
|
||||
|
||||
##### exclude
|
||||
|
||||
Type: `array` of (`string`|`regex`)
|
||||
Default: `[/.+Sync$/]`
|
||||
|
||||
Methods in a module **not** to promisify. Methods with names ending with `'Sync'` are excluded by default.
|
||||
|
||||
##### excludeMain
|
||||
|
||||
Type: `boolean`
|
||||
Default: `false`
|
||||
|
||||
By default, if given module is a function itself, this function will be promisified. Turn this option on if you want to promisify only methods of the module.
|
||||
|
||||
```js
|
||||
const pify = require('pify');
|
||||
|
||||
function fn() {
|
||||
return true;
|
||||
}
|
||||
|
||||
fn.method = (data, callback) => {
|
||||
setImmediate(() => {
|
||||
callback(data, null);
|
||||
});
|
||||
};
|
||||
|
||||
// promisify methods but not fn()
|
||||
const promiseFn = pify(fn, {excludeMain: true});
|
||||
|
||||
if (promiseFn()) {
|
||||
promiseFn.method('hi').then(data => {
|
||||
console.log(data);
|
||||
});
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](http://sindresorhus.com)
|
||||
76
node_modules/executable/package.json
generated
vendored
76
node_modules/executable/package.json
generated
vendored
@@ -1,68 +1,34 @@
|
||||
{
|
||||
"_from": "executable@^4.1.0",
|
||||
"_id": "executable@4.1.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-8iA79xD3uAch729dUG8xaaBBFGaEa0wdD2VkYLFHwlqosEj/jT66AzcreRDSgV7ehnNLBW2WR5jIXwGKjVdTLg==",
|
||||
"_location": "/executable",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "executable@^4.1.0",
|
||||
"name": "executable",
|
||||
"escapedName": "executable",
|
||||
"rawSpec": "^4.1.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^4.1.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/bin-check"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/executable/-/executable-4.1.1.tgz",
|
||||
"_shasum": "41532bff361d3e57af4d763b70582db18f5d133c",
|
||||
"_spec": "executable@^4.1.0",
|
||||
"_where": "/var/www/html/jason/WeihnachtenMelly/node_modules/bin-check",
|
||||
"name": "executable",
|
||||
"version": "1.1.0",
|
||||
"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"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/kevva/executable/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"pify": "^2.2.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Check if a file is executable",
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"xo": "*"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/kevva/executable#readme",
|
||||
"keywords": [
|
||||
"exec",
|
||||
"executable",
|
||||
"permission"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "executable",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/kevva/executable.git"
|
||||
"bin": {
|
||||
"executable": "cli.js"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
"test": "node test/test.js"
|
||||
},
|
||||
"version": "4.1.1",
|
||||
"xo": {
|
||||
"esnext": true
|
||||
"files": [
|
||||
"cli.js",
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"exec"
|
||||
],
|
||||
"dependencies": {
|
||||
"meow": "^3.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^0.0.4"
|
||||
}
|
||||
}
|
||||
|
||||
53
node_modules/executable/readme.md
generated
vendored
53
node_modules/executable/readme.md
generated
vendored
@@ -1,6 +1,6 @@
|
||||
# executable [](https://travis-ci.org/kevva/executable)
|
||||
# executable [](https://travis-ci.org/kevva/executable)
|
||||
|
||||
> Check if a file is executable
|
||||
> Check if a file is executable using Node.js
|
||||
|
||||
|
||||
## Install
|
||||
@@ -13,50 +13,33 @@ $ npm install --save executable
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const executable = require('executable');
|
||||
var executable = require('executable');
|
||||
|
||||
executable('bash').then(exec => {
|
||||
executable('bash', function (err, exec) {
|
||||
console.log(exec);
|
||||
//=> true
|
||||
});
|
||||
|
||||
executable.sync('bash');
|
||||
//=> true
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
## CLI
|
||||
|
||||
### executable(file)
|
||||
```
|
||||
$ npm install --global executable
|
||||
```
|
||||
|
||||
Returns a Promise for a boolean.
|
||||
```
|
||||
$ executable --help
|
||||
|
||||
### executable.sync(file)
|
||||
Usage
|
||||
$ executable <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
|
||||
Example
|
||||
$ executable optipng
|
||||
```
|
||||
|
||||
|
||||
## License
|
||||
|
||||
Reference in New Issue
Block a user