isexe权限检测 - 编程技术参考——模具行业从业者必备知识手册
-
<h2>isexe</h2>
<p>Minimal module to check if a file is executable, and a normal file.</p>
<p>Uses <code>fs.stat</code> and tests against the <code>PATHEXT</code> environment variable on</p>
<p>Windows.</p><h3>USAGE</h3>
<pre><code>
var isexe = require('isexe')
isexe('some-file-name', function (err, isExe) {
if (err) {
console.error('probably file does not exist or something', err)
} else if (isExe) {
console.error('this thing can be run')
} else {
console.error('cannot be run')
}
})// same thing but synchronous, throws errors
var isExe = isexe.sync('some-file-name')// treat errors as just "not executable"
isexe('maybe-missing-file', { ignoreErrors: true }, callback)
var isExe = isexe.sync('maybe-missing-file', { ignoreErrors: true })
</code></pre><h3>API</h3>
<h4>
isexe(path, [options], [callback])</h4><p>Check if the path is executable. If no callback provided, and a</p>
<p>global <code>Promise</code> object is available, then a Promise will be returned.</p><p>Will raise whatever errors may be raised by <code>fs.stat</code>, unless</p>
<p><code>options.ignoreErrors</code> is set to true.</p><h4>
isexe.sync(path, [options])</h4><p>Same as <code>isexe</code> but returns the value and throws any errors raised.</p>
<h4>Options</h4>
<ul>
<li><code>ignoreErrors</code> Treat all errors as "no, this is not executable", but</li>
</ul>
<p> don't raise them.</p>
<ul>
<li><code>uid</code> Number to use as the user id</li>
<li><code>gid</code> Number to use as the group id</li>
<li><code>pathExt</code> List of path extensions to use instead of <code>PATHEXT</code></li>
</ul>
<p> environment variable on Windows.</p><hr>
<p>本文由模极社发布</p>
<hr>
<p>!<a href="upload://eOhMT1Q2yBePqWXJHc1w3KIwvWy.svg">isexe权限检测 - 编程技术参考</a></p><hr>
<h4>
你可能还感兴趣</h4>
<ul>
<li><a href="/t/3112/3112">MIM飞边</a></li>
<li><a href="/t/2760/2760">高光模温机选型与使用指南</a></li>
<li><a href="/t/3536/3536">天津国际模具城</a></li>
</ul><hr>
<p><strong>相关推荐:</strong></p>
<ul>
<li><a href="https://www.mj7.cn/t/4836-4836">北京模具产业 — 科技研发驱动型模具基地</a></li>
<li><a href="https://www.mj7.cn/t/4835-4835">上海模具产业 — 高端精密模具研发中心</a></li>
<li><a href="https://www.mj7.cn/t/4834-4834">产业集群与模具产业发展的关系</a></li>
</ul><hr>
<p>你们厂里是怎么处理的?来评论区聊聊。</p>