# md-file-tree-enhanced

> 生成文件目录列表到Markdown文件中

Latest version **0.1.1** (published 2021-07-28) · 0 weekly downloads

## Install

```sh
npm install md-file-tree-enhanced
pnpm add md-file-tree-enhanced
yarn add md-file-tree-enhanced
bun add md-file-tree-enhanced
```

Provides the command `md-file-tree-enhanced`.

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2021-07-28 |
| First published | 2021-07-28 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 4 |
| Unpacked size | 10.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | xlzy520 |
| Maintainers | zhibi |
| Keywords | md, file, tree |

## Links

- npm: https://www.npmjs.com/package/md-file-tree-enhanced
- Repository: https://github.com/xlzy520/md-file-tree
- Homepage: https://github.com/xlzy520/md-file-tree#readme
- Issues: https://github.com/xlzy520/md-file-tree/issues
- npm.io page: https://npm.io/package/md-file-tree-enhanced

## Dependencies (4)

- [bumpp](https://npm.io/package/bumpp.md) ^6.0.6
- [fs-extra](https://npm.io/package/fs-extra.md) ^10.0.0
- [event-state](https://npm.io/package/event-state.md) ^0.3.5
- [@jsdevtools/readdir-enhanced](https://npm.io/package/@jsdevtools/readdir-enhanced.md) ^6.0.4

## Alternatives

- [unionfs](https://npm.io/package/unionfs.md) — 2.2M weekly downloads
- [path-starts-with](https://npm.io/package/path-starts-with.md) — 35.9K weekly downloads
- [redzip](https://npm.io/package/redzip.md) — 1.2K weekly downloads
- [vscode-anymatch](https://npm.io/package/vscode-anymatch.md) — 848 weekly downloads
- [@ledgerhq/coin-filecoin](https://npm.io/package/@ledgerhq/coin-filecoin.md) — 793 weekly downloads

## Recent versions

- 0.1.1 (latest) — 2021-07-28

## README

# node-file-tree-md

Generate markdown tree of all the files in a directory, recursively.Custom directory name, file name
生成文件目录列表到Markdown文件中，可以设置过滤的文件后缀名,或自定义目录名、文件名

## How to use?

### Install the script

### Usage
options extends [readdir-enhanced](https://github.com/JS-DevTools/readdir-enhanced)

Basic
```js
import readdir from "@jsdevtools/readdir-enhanced";

// Find all .txt files
readdir("my/directory", {filter: "*.txt"});

// Find all package.json files
readdir("my/directory", {filter: "**/package.json", deep: true});
```

### Extra Options
- formatFileName: function
- formatDirectoryName: function,
- outputFilePath: string,
- prefix: array,
- ignore: array

```js
const defaultOptions = {
  formatFileName,
  formatDirectoryName,
  deep: stats => ignoreNodeModules(stats, defaultOptions),
  filter: stats => myFilter(stats, defaultOptions),
  outputFilePath: 'list.md',
  prefix: ['.html'],
  ignore: ['node_modules', '.git', '.idea'],
}
```

### Example
```js
const {generateMdTree} = require('md-file-tree-enhanced')

generateMdTree('.', {
  outputFilePath: 'readme.md',
  prefix: ['.html', '.js'],
  ignore: ['node_modules', '.git', '.idea'],
  formatDirectoryName: (name)=>{
    return name+'1'+'\n'
  },
  formatFileName: (name, path)=>{
    return name+path+'\n'
  },
  // or
  // filter: myFilter,

}).then(({ output, files }) => {
  // console.log(res);
})
```


This generates the `list.md` file with:

```markdown
 - __CSS__
    - [IEMUSTGODIE.html](CSS/IEMUSTGODIE.html)
    - [Love Heart.js](CSS/Love Heart.js)
    - [WebpackIcon.html](CSS/WebpackIcon.html)
    - [border-arrow.html](CSS/border-arrow.html)
    - __box-shadow__
        - [box-shadow.html](CSS/box-shadow/box-shadow.html)
        - [aaa.js](CSS/box-shadow/aaa.js)
    - [linear-gradient.html](CSS/linear-gradient.html)
    - [photo-3d.html](CSS/photo-3d.html)
```

---
_Source: https://npm.io/package/md-file-tree-enhanced · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
