Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/file/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
File 具有文件查询功能的NodeJS库_File_Node.js - Fatal编程技术网

File 具有文件查询功能的NodeJS库

File 具有文件查询功能的NodeJS库,file,node.js,File,Node.js,我正在搜索具有查询功能的库。假设我想获取项目中某个目录中的所有JS文件。我可以做类似的事情 filesystem.query({ paths:[{ path:"c:/path/to/dir", recursive:true }], types:[".js"], excludes:["test.js"] },successFn,failFn); 有任何库具有此功能吗?有一些模块具有此类过滤功能: 使用 使用 您调查了哪些模块

我正在搜索具有查询功能的库。假设我想获取项目中某个目录中的所有JS文件。我可以做类似的事情

filesystem.query({
    paths:[{
        path:"c:/path/to/dir",
        recursive:true
    }],
    types:[".js"],
    excludes:["test.js"]
},successFn,failFn);

有任何库具有此功能吗?

有一些模块具有此类过滤功能:

使用

使用


您调查了哪些模块?我主要关注的是FS模块签出,这可能会引导您走向或…那些看起来很有希望的
readdirp({root:path.join(u dirname),fileFilter:'*.js'})将此添加为答案,我将接受它。谢谢
var fs = require('fs');
fs.readdir('.', function (error, files)
{
    files.filter(function (fileName)
    {
        return /.*.js$/.test(fileName);
    }).forEach(yourfunc);
});
require("glob").glob("*.js", function (er, files) { ... });