fast-glob
NodeJS 18.18.0+
概述
这是一个非常快速高效的Node.js glob 库。
安装
npm
npm install fast-glob
pnpm
pnpm add fast-glob
yarn
yarn add fast-glob
使用
import { glob, globStream, globSync } from 'fast-glob'
// 异步模式
const entries = await glob(['.editorconfig', '**/index.js'], { dot: true })
// 同步模式
const entries = globSync(['.editorconfig', '**/index.js'], { dot: true })
// 流模式
const stream = globStream(['.editorconfig', '**/index.js'], { dot: true })
for await (const entry of stream) {
// .editorconfig
// services/index.js
}