1.1.3 • Published 1 year ago
@karmaniverous/dirtree v1.1.3
dirtree
Parses a directory into a nicely-formatted ASCII tree. Includes a CLI.
To install:
npm install @karmaniverous/dirtree
To import:
import { dirtree } from '@karmaniverous/dirtree`;
An Example
PS C:\> dirtree -d src -a size
└─ src
├─ cli
│ └─ index.mjs: 1344
└─ export
├─ dirtree
│ ├─ dirtree.mjs: 2045
│ └─ dirtree.test.mjs: 303
└─ index.mjs: 73
Command Line Interface
Usage: dirtree [options]
Options:
-a, --attribute <string> Decorate files with an fs.Stats attribute. https://nodejs.dev/en/api/v19/fs/#fsstats
-n, --depth <int> Limit the tree to this depth. Default is unlimited.
-d, --dir <string> Path to starting directory. Defaults to current working directory.
-e, --exclude <string> RegExp pattern to exclude paths from tree.
-h, --help display help for command
API Documentation
dirtree(options) ⇒ string
Extracts an ascii tree representing the file structure under a directory path.
Kind: global function
Returns: string - ASCII tree.
Param | Type | Description |
---|---|---|
options | Object | Options object. |
options.attribute | string | Decorate files with an fs.Stats attribute. https://nodejs.dev/en/api/v19/fs/#fsstats |
options.debug | boolean | Log intermediate steps to console. |
options.depth | number | Limit the tree to this depth. Default is unlimited. |
options.dir | string | Path to starting directory. Defaults to current working directory. |
options.exclude | RegExp | RegExp pattern to exclude paths from tree. |
See more great templates and other tools on my GitHub Profile!