模极社社区 - 制造业全产业链交流平台

    • 登录
    • 版块
    • 最新
    • 话题
    • 热门
    • 用户
    • 群组

    isexe权限检测 - 编程技术参考——模具行业从业者必备知识手册

    社区公告
    1
    1
    0
    正在加载更多帖子
    • 从旧到新
    • 从新到旧
    • 最多赞同
    回复
    • 在新帖中回复
    登录后回复
    此主题已被删除。只有拥有主题管理权限的用户可以查看。
    • S
      system 2 最后由 编辑

      <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>

      1 条回复 最后回复 回复 引用 0
      • First post
        Last post
      Powered by NodeBB | Contributors