【问题标题】:How to include multiple file extensions with 'glob.sync' in NodeJS?如何在 NodeJS 中包含多个带有“glob.sync”的文件扩展名?
【发布时间】:2017-03-30 12:42:23
【问题描述】:

谁能建议如何使用glob.sync 方法添加多个文件扩展名。

类似:

const glob = require('glob');
let files = glob.sync(path + '**/*.(html|xhtml)');

谢谢你:)

【问题讨论】:

    标签: node.js node-glob


    【解决方案1】:

    您可以使用它(大多数 shell 也支持):

    glob.sync(path + '**/*.{html,xhtml}')
    

    或其中之一:

    glob.sync(path + '**/*.+(html|xhtml)')
    glob.sync(path + '**/*.@(html|xhtml)')
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-12-13
      • 2017-07-16
      • 2011-03-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多