file-treegen
v1.0.0
Published
Generate a visual file tree for any directory. Cross-platform, respects .gitignore, zero dependencies.
Maintainers
Readme
file-treegen
Generate a visual file tree for any directory. Cross-platform, respects .gitignore, zero dependencies.
Install
npm install -g file-treegenUsage
# Current directory
ftree
# Specific directory
ftree ./src
# Limit depth
ftree -L 3
# Include hidden files
ftree -a
# Directories only
ftree -d
# Output as markdown code block
ftree --markdown
# Save to file
ftree -o tree.md
# Copy to clipboard
ftree -c
# Combine flags
ftree ./my-project -L 2 -m -o structure.mdExample Output
my-project/
├── src/
│ ├── components/
│ │ ├── Button.tsx
│ │ └── Header.tsx
│ ├── utils/
│ │ └── helpers.ts
│ └── index.ts
├── package.json
├── README.md
└── tsconfig.jsonOptions
| Flag | Description |
|------|-------------|
| -h, --help | Show help |
| -v, --version | Show version |
| -a, --all | Include hidden files (dotfiles) |
| -d, --dirs-only | Show directories only |
| -L, --depth <n> | Max depth to traverse |
| -m, --markdown | Wrap output in markdown code block |
| -o, --output <file> | Write output to a file |
| -c, --copy | Copy to clipboard |
| --no-gitignore | Don't respect .gitignore rules |
Features
- 🌳 Beautiful ASCII tree output
- 📁 Respects
.gitignorepatterns - 🚫 Auto-skips
node_modules,.git, etc. - 📋 Copy to clipboard with
-c - 📝 Markdown output with
-m - 🖥️ Cross-platform (macOS, Linux, Windows)
- 📦 Zero dependencies
License
MIT © kszongic
