fast-glob

2023/11/29 工具链

# 基础用法

fast-glob 用于获取路径。这里写个简单的 示例 (opens new window),fast-glob 详细的 API 请查看fast-glob (opens new window)

import glob from 'fast-glob'

await glob([globSourceFile, '!element-plus/**/*'], {
  cwd: pkgRoot,
  absolute: true,
  onlyFiles: true
})
1
2
3
4
5
6
7

# 了解更多

获取路径后,对文件管理(包括文件读写)还有一个非常实用的包 fs-extra (opens new window)

import fs from 'fs-extra'
// both fs and fs-extra methods are defined
1
2

然后是读取文件的方法参考:https://nodejs.dev/en/learn/reading-files-with-nodejs/ (opens new window)

更新时间: 2023/11/29 15:42:16