且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

查找具有通配符匹配的文件

更新时间:2021-09-26 15:51:53

Node核心未涵盖此内容.您可以查看此模块以了解所需内容. npmjs.org还是查找各种模块的好资源.

This is not covered by Node core. You can check out this module for what you are after. npmjs.org is also a great resource for finding various modules.

var glob = require("glob")

// options is optional
glob("**/*.js", options, function (er, files) {
  // files is an array of filenames.
  // If the `nonull` option is set, and nothing
  // was found, then files is ["**/*.js"]
  // er is an error object or null.
})