# 遍历目录树

遍历指定路径的目录树


## 示例

### eachDirTree(callback, dirPath[, ignores])

- `callback` `<Function>` 必须的: 处理每个文件/文件夹的回调函数。
- `dirPath` `<string>` 必须的: 文件夹的绝对路径。
- `ignores` `<string[] | undefined>` 可选的: 忽略的文件/文件夹列表。

遍历指定的文件夹, 并调用 `callback` 函数 

```js
eachDirTree((fileItem) => {
  // fileItem =>> { 
  //    path: string; // 文件/文件夹的绝对路径
  //    isDirectory: boolean; // 是否为文件夹
  // }
}, dirPath, ['node_modules'])
```

### dirFileList(dirPath[, ignores])

- `dirPath` `<string>` 必须的: 文件夹的绝对路径。
- `ignores` `<string[] | undefined>` 可选的: 忽略的文件/文件夹列表。

获取指定文件夹下所有的文件列表, 返回一个包含所有文件绝对地址的数组

```js
const fileList = dirFileList(dirPath, ['node_modules'])
// fileList =>> string[]
```

### dirTree(dirPath, ignores)

- `dirPath` `<string>` 必须的: 文件夹的绝对路径。
- `ignores` `<string[] | undefined>` 可选的: 忽略的文件/文件夹列表。

获取指定文件夹下的文件树, 返回一个树结构, 包含 `path`、`isDirectory`、`children` 三个字段

```js
const dirTree = dirFileList(dirPath, ['node_modules'])
// dirTree =>> Array<{
//  path: string; // 文件/文件夹的绝对路径
//  isDirectory: boolean; // 是否为文件夹
//  children: Array<Object>; // 子集
// }>
```
