UNPKG

treefiy

Version:

Tool for visualizing folder structure

102 lines (84 loc) β€’ 3.26 kB
# Treefiy 🌳 [![MIT License](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE) [![CLI Version](https://img.shields.io/npm/v/treefiy)](https://npmjs.com/package/treefiy) [![Fastify API](https://img.shields.io/badge/API-Fastify-FFD700.svg)](https://fastify.io) A lightweight, pluggable CLI and API tool for directory structure visualization and analysis. ## πŸ“š Table of Contents - [Features](#-features) - [Installation](#-installation) - [Usage](#-usage) - [Project Structure](#-project-structure) - [Architecture](#-architecture) - [API Documentation](#-api-documentation) - [License](#-license) --- ## 🌟 Features - πŸ“ **Multi-format Visualization**: Generate trees in JSON - ⚑ **High Performance**: Optimized directory traversal algorithms - 🟒 **CLI Commands**: Interactive commands - πŸ“Š **File Metadata**: Display size, permissions, and modification dates - 🌐 **Web UI**: Browser-based visualization with React - πŸ“‘ **REST API**: Integration-ready HTTP endpoints --- ## πŸ“₯ Installation ### Local Development (Contributors) ```bash git clone https://github.com/zyadamr-dev/treefiy.git cd treefiy npm install npm link # Creates global symlink ``` ### Global install (Users) ```bash npm install -g treefiy ``` ## 🟒 Usage ```bash treefiy <command> [options] ``` ### Example ```bash treefiy gen-tree --pth=D:/projects --showSize=true --skipDirs=node_modules ``` - For more info about how to use it you can excute command ```bash treefiy help ``` ## πŸ—‚οΈ Project Structure ```bash β”œβ”€β”€ src/ β”‚ β”œβ”€β”€ .config/ # App configuration & logging β”‚ β”‚ β”œβ”€β”€ cached-config/ # Cached user configs β”‚ β”‚ β”œβ”€β”€ cliStyleConfig.js # CLI tree style formatting β”‚ β”‚ β”œβ”€β”€ defaultConfig.js # Default settings β”‚ β”‚ └── logger.js # Logger setup β”‚ β”œβ”€β”€ api/ # Fastify API server β”‚ β”‚ β”œβ”€β”€ functions.js # Tree generation logic β”‚ β”‚ └── server.js # Fastify application β”‚ β”œβ”€β”€ cli/ # CLI command dispatcher β”‚ β”‚ β”œβ”€β”€ commands/ # Individual command modules β”‚ β”‚ └── index.js # Main CLI entry point β”‚ β”œβ”€β”€ constants/ # Shared constants (e.g., aliases) β”‚ β”‚ └── cmdAlias.js β”‚ β”‚ └── outFormat.js β”‚ β”œβ”€β”€ core/ # Core functionality β”‚ β”‚ β”œβ”€β”€ index.js # Visualizer class & tree logic β”‚ β”‚ └── ui/ # React frontend for visualization β”‚ └── utils/ # Utility modules (spinner, config parser) β”‚ β”œβ”€β”€ spinner.js β”‚ β”œβ”€β”€ parseConfig.js β”‚ └── index.js β”œβ”€β”€ LICENSE └── package.json ``` --- ## ⛏️ Architecture ![Component Diagram](images/Architecture%20of%20treefiy.jpg "High‑level Component Diagram") --- ## ✨ API Documentation ### Endpoints - GET api/tree?pth=[dir]&showSize=true - Generate directory structure - GET api/config - View active configuration --- ## πŸͺͺ License MIT Β© 2025 β€” Zyad A.