concurrency | cpu.length | - | 最大并发请求数 |
cwd | 当前 | const fg = require("fast-glob");
const entries = fg.sync(["*", ".*"], { cwd: "./ellis_error" });
console.log(entries);
| Current Work Dir |
deep | 1 | dir/
└── one/ // 1
└── two/ // 2
└── file.js // 3
// With base directory
fg.sync('dir/**', { onlyFiles: false, deep: 1 }); // ['dir/one']
fg.sync('dir/**', { onlyFiles: false, deep: 2 }); // ['dir/one', 'dir/one/two']
// With cwd option
fg.sync('**', { onlyFiles: false, cwd: 'dir', deep: 1 }); // ['one']
fg.sync('**', { onlyFiles: false, cwd: 'dir', deep: 2 }); // ['one', 'one/two']
| 深度 |
followSymbolicLinks | - | | |
fs | - | | 默认 fs 实现 |
absolute | | fg.sync('*.js', { absolute: false }); // ['index.js']
fg.sync('*.js', { absolute: true }); // ['/home/user/index.js']
| |
markDirectories | | fg.sync('*', { onlyFiles: false, markDirectories: false }); // ['index.js', 'controllers']
fg.sync('*', { onlyFiles: false, markDirectories: true }); // ['index.js', 'controllers/']
| |
objectMode | | fg.sync('*', { objectMode: false }); // ['src/index.js']
fg.sync('*', { objectMode: true }); // [{ name: 'index.js', path: 'src/index.js', dirent: <fs.Dirent> }]
| |
onlyDirectories | | fg.sync('*', { onlyDirectories: false }); // ['index.js', 'src']
fg.sync('*', { onlyDirectories: true }); // ['src']
| 仅保存目录 |
onlyFiles | | fg.sync('*', { onlyFiles: false }); // ['index.js', 'src']
fg.sync('*', { onlyFiles: true }); // ['index.js']
| |
stats | false | | 将文件 信息 添加进来 |
unique | true | fg.sync(['*.json', 'package.json'], { unique: false }); // ['package.json', 'package.json']
fg.sync(['*.json', 'package.json'], { unique: true }); // ['package.json']
| |
caseSensitiveMatch | | dir/
├── file.txt
└── File.txt
fg.sync('file.txt', { caseSensitiveMatch: false }); // ['file.txt', 'File.txt']
fg.sync('file.txt', { caseSensitiveMatch: true }); // ['file.txt']
| 大小写敏感 |
dot | false | dir/
├── .editorconfig
└── package.json
fg.sync('*', { dot: false }); // ['package.json']
fg.sync('*', { dot: true }); // ['.editorconfig', 'package.json']
| 对点文件处理 |
globstar | false | dir/
└── a
└── b
fg.sync('**', { onlyFiles: false, globstar: false }); // ['a']
fg.sync('**', { onlyFiles: false, globstar: true }); // ['a', 'a/b']
| 对** 情况的递归 |