@herberthe/filestree
v1.3.1
Published
A library for generating files tree.
Downloads
6
Maintainers
Readme
FilesTree
A library for generating files tree.
Install
npm i @herberthe/filestree
# Or
yarn add @herberthe/filestree
# Or
pnpm add @herberthe/filestree
Usage
import { FilesTree } from "filestree"
const tree = new FilesTree({
entry: "<Your Entry Path Here>",
...otherOptions
}).output()
console.log(tree)
Options
| Option | Type | Required | Default | Description |
| ------ | -------------------------------------------------------------------------- | -------- | ------------ | --------------------------------------------------------------------------------------------------------------------- |
| entry | string
string[]
| √ | - | The entry path |
| depth | number
| × | Infinity
| The depth of tree |
| filter | RegExp
FilterFunctionType
| × | - | The filter for filename |
| path | "relative"
"absolute"
| × | "absolute"
| The path type for output |
| flat | boolean
| × | false
| Flat the tree |
| output | "path"
"stats"
| × | "path"
| The output type |
| custom | <T extends any = any>(filename: string, path: string, stats: Stats) => T
| × | - | The custom output result function, If the optional function custom
existed, the output
option would not work! |
For more details, see Types Defination
LICENSE
MIT