函数 find"/>
node js 内置 os 函数 find
我正在使用 shelljs npm 包进行文件遍历:
var shell = require('shelljs');
cFilesOnly = function (file, idx) { return (file.includes('.c')); }
excludeIrrelevantDir = function (file, idx) { return !file.includes('DDD'); }
var files = shell.find('.').filter(cFilesOnly).filter(excludeIrrelevantDir);
console.log(files);
包装很棒:
$ tree
.
├── AAA
│ └── main.c
├── BBB
│ ├── README.md
│ ├── go.c
│ └── run.c
├── DDD
│ └── bad.c
└── main.js
4 directories, 6 files
$ node main.js
[ 'AAA/main.c', 'BBB/go.c', 'BBB/run.c' ]
- npm 在该包中报告了
,所以1 high severity vulnerability
- 我想用 native node os alternative 替换那个包。
- 我看了(here)但没走多远-我错过了什么?
更多推荐
node js 内置 os 函数 find
发布评论