dendro (Ξ΄ΞΞ½Ξ΄ΟΞΏ) - from the Greek word for "tree"
A beautiful, fast directory tree visualization CLI with intuitive file type icons.
π GitHub Repository | π¦ npm Package
The name dendro comes from the Greek word Ξ΄ΞΞ½Ξ΄ΟΞΏ (pronounced "DEN-droh"), meaning "tree". It's:
- Memorable - Short, unique, and easy to remember
- Meaningful - Directly relates to tree structures and hierarchies
- Professional - Used in scientific contexts (dendrology, dendrochronology)
- Global - Recognizable across languages due to its Greek root
- Concise - Just 6 letters, quick to type
When you visualize directory structures, you're essentially mapping a treeβand that's exactly what dendro does, with style.
- π³ Beautiful tree visualization with Unicode box-drawing characters
- π¨ Smart file type icons for instant visual recognition
- β‘ Lightning fast - optimized directory traversal
- π― Flexible filtering with regex pattern support
- π Built-in statistics (file counts, directory counts)
- π§ Both CLI and programmatic API
- π Smart defaults (auto-excludes node_modules, .git, etc.)
npm install -g @crashbytes/dendronpx @crashbytes/dendrogit clone https://github.com/CrashBytes/dendro.git
cd dendro
npm install
npm link# Visualize current directory
dendro
# Visualize specific directory
dendro /path/to/project
# Limit depth to 3 levels
dendro ~/projects -d 3
# Show all files including hidden
dendro -a
# Show help
dendro --helpUsage: dendro [path] [options]
Arguments:
path Directory path to display (default: ".")
Options:
-V, --version Output version number
-d, --max-depth <number> Maximum depth to traverse
-a, --all Show hidden files and directories
--no-icons Disable file type icons
-p, --show-paths Show full paths
-e, --exclude <patterns> Patterns to exclude (regex)
--no-stats Hide statistics summary
-h, --help Display help
# Show only 2 levels deep
dendro -d 2
# Show all files including hidden ones
dendro -a
# Exclude specific patterns (node_modules, test directories)
dendro -e "node_modules" "test" "__pycache__"
# Show full file paths
dendro -p
# Plain text output (no icons)
dendro --no-icons
# Combine options
dendro ~/my-project -d 3 -a -e "*.log" "dist"dendro automatically detects and displays appropriate icons for common file types:
| Icon | File Types |
|---|---|
| π | Directories |
| π | JavaScript (.js, .jsx, .mjs, .cjs) |
| π | TypeScript (.ts, .tsx) |
| π | JSON (.json) |
| π | Markdown (.md, .mdx) |
| π¨ | Stylesheets (.css, .scss, .sass, .less) |
| π | HTML (.html, .htm) |
| πΌοΈ | Images (.png, .jpg, .gif, .svg, .webp) |
| π¬ | Videos (.mp4, .avi, .mov, .mkv) |
| π΅ | Audio (.mp3, .wav, .ogg, .m4a) |
| π | PDFs (.pdf) |
| ποΈ | Archives (.zip, .tar, .gz, .rar, .7z) |
| ποΈ | Databases (.db, .sqlite, .sql) |
| βοΈ | Config files (.yaml, .yml, .toml, .ini) |
| π | Lock files (package-lock.json, yarn.lock) |
| π¦ | Git files (.gitignore, .gitattributes) |
| π | Other text files |
Use dendro in your Node.js projects:
const { buildTree, renderTree, getTreeStats } = require('@crashbytes/dendro');
// Build a tree structure
const tree = buildTree('/path/to/directory', {
maxDepth: 3,
showHidden: false,
excludePatterns: [/node_modules/, /\.git/]
});
// Render as text
const output = renderTree(tree, {
showIcons: true,
showPaths: false
});
console.log(output);
// Get statistics
const stats = getTreeStats(tree);
console.log(`${stats.directories} directories, ${stats.files} files`);Builds a tree data structure from a directory.
Parameters:
dirPath(string) - Path to directoryoptions(object)maxDepth(number) - Maximum depth to traverse (default: Infinity)showHidden(boolean) - Include hidden files (default: false)excludePatterns(RegExp[]) - Patterns to exclude (default: [])
Returns: Tree object with structure:
{
name: string,
type: 'file' | 'directory',
icon: string,
path: string,
children?: TreeNode[]
}Renders a tree structure as formatted text.
Parameters:
tree(object) - Tree structure from buildTreeoptions(object)showIcons(boolean) - Display file type icons (default: true)showPaths(boolean) - Display full paths (default: false)prefix(string) - Internal use for recursionisLast(boolean) - Internal use for recursion
Returns: Formatted string representation
Calculates statistics for a tree.
Returns: Object with { files: number, directories: number }
By default (without -a flag), dendro excludes:
- Hidden files/directories (starting with
.) node_modules.git.DS_Storedistbuildcoverage
Override with -a or use -e to add custom exclusions.
const { buildTree, renderTree } = require('@crashbytes/dendro');
// Build tree
const tree = buildTree('.', { maxDepth: 3 });
// Filter to show only JavaScript files
function filterJS(node) {
if (node.type === 'file') {
return /\.(js|jsx|ts|tsx)$/.test(node.name) ? node : null;
}
if (node.children) {
const filtered = node.children.map(filterJS).filter(Boolean);
return filtered.length > 0 ? { ...node, children: filtered } : null;
}
return null;
}
const jsOnly = filterJS(tree);
console.log(renderTree(jsOnly));// In your build script
const { buildTree, getTreeStats } = require('@crashbytes/dendro');
const tree = buildTree('./dist');
const stats = getTreeStats(tree);
console.log(`Build output: ${stats.files} files in ${stats.directories} directories`);See the /examples directory for more usage examples:
basic-usage.js- Simple tree visualizationadvanced-usage.js- Custom filtering and statistics
We welcome contributions! Here's how you can help:
- Fork the repository on GitHub
- Clone your fork
git clone https://github.com/YOUR-USERNAME/dendro.git cd dendro npm install - Create a feature branch
git checkout -b feature/amazing-feature
- Make your changes and test them
npm test node bin/cli.js - Commit your changes
git commit -m "Add amazing feature" - Push to your fork
git push origin feature/amazing-feature
- Open a Pull Request on GitHub
- π¨ Add more file type icons
- β‘ Performance optimizations
- π Documentation improvements
- π Bug fixes
- β¨ New features
Found a bug or have a feature request? Please open an issue on GitHub Issues.
When reporting bugs, please include:
- Your OS and Node.js version
- Steps to reproduce
- Expected vs actual behavior
- Screenshots if applicable
npm test# Clone the repository
git clone https://github.com/CrashBytes/dendro.git
cd dendro
# Install dependencies
npm install
# Link for local testing
npm link
# Make changes and test
dendro ~/test-directorySee CHANGELOG.md for version history.
MIT License - see LICENSE file for details.
CrashBytes
- Website: crashbytes.com
- GitHub: @CrashBytes
- Twitter: @crashbytes
Built with β€οΈ for developers who love beautiful CLIs.
Special thanks to all contributors who help make dendro better!
If you find dendro useful, please:
- β Star the project on GitHub
- π¦ Share it on social media
- π Write a blog post about it
- π¬ Tell your developer friends
dendro - Because every great project starts with understanding its structure π³