import fg from 'fast-glob'// 基本目录fg.sync('dir/**', { onlyFiles: false, deep: 1 }); // ['dir/one']fg.sync('dir/**', { onlyFiles: false, deep: 2 }); // ['dir/one', 'dir/one/two']// 使用 cwd 选项fg.sync('**', { onlyFiles: false, cwd: 'dir', deep: 1 ...
sync('**/*.js').forEach(file => { console.log(file); }); 运行这段代码应该会在控制台中列出项目中的所有 .js 文件。 5. 重启开发服务器 在安装完缺失的 fast-glob 模块后,你需要重新启动你的开发服务器。这通常可以通过运行一个特定的命令来完成,该命令取决于你使用的开发服务器工具(例如,...
globSync('**', { onlyFiles: false, cwd: 'dir', deep: 2 }); // ['one', 'one/two'] 📖 If you specify a pattern with some base directory, this directory will not participate in the calculation of the depth of the found directories. Think of it as a cwd option. followSymbolic...
· fast-glob 514.57 1.2824 3.5067 1.9434 2.0127 3.3144 3.5067 3.5067 ±2.46% 129 · tiny-fast-glob 6,421.22 0.1056 1.5651 0.1557 0.1682 0.2887 0.3518 1.4108 ±2.43% 1606 fastest BENCH Summary tiny-fast-glob - bench/index.bench.ts > 6.44x faster than fast-glob tiny-fast-glob - bench/sync....
globSync('*.json', { ignore: ['package-lock.json'] }); // ['package.json'] suppressErrors Type: boolean Default: false By default this package suppress only ENOENT errors. Set to true to suppress any error. 📖 Can be useful when the directory has entries with a special level of ...
const code = esbuild.transformSync(fs.readFilesync(filePath), { loader: 'ts', }) console.log(code); // 输出 // { // code: 'const str = 'Hello World'', // map: '', // warnings: [] // } 2.build:整合了transform后的代码,可以将一个或者多个文件转换并保存为文件; ...
globSync('dir/**', { onlyFiles: false, deep: 2 }); // ['dir/one', 'dir/one/two'] // With cwd option fg.globSync('**', { onlyFiles: false, cwd: 'dir', deep: 1 }); // ['one'] fg.globSync('**', { onlyFiles: false, cwd: 'dir', deep: 2 }); // ['one',...
// With base directoryfg.globSync('dir/**',{onlyFiles:false,deep:1});// ['dir/one']fg.globSync('dir/**',{onlyFiles:false,deep:2});// ['dir/one', 'dir/one/two']// With cwd optionfg.globSync('**',{onlyFiles:false,cwd:'dir',deep:1});// ['one']fg.globSync('**'...
globSync(['.editorconfig', '**/index.js'], { dot: true }); // ['.editorconfig', 'services/index.js'] Stream fg.globStream(patterns, [options]) fg.stream(patterns, [options]) Returns a ReadableStream when the data event will be emitted with matching entry. const fg = require('fast...
globSync('**', { onlyFiles: false, cwd: 'dir', deep: 2 }); // ['one', 'one/two'] 📖 If you specify a pattern with some base directory, this directory will not participate in the calculation of the depth of the found directories. Think of it as a cwd option. followSymbolic...