npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

prettify-folder-structure

v1.0.0

Published

A CLI tool for converting between plain text and ASCII tree folder structures

Readme

Prettify Folder Structure

A CLI tool for converting between plain indented text and visual ASCII tree representations of folder structures. Share folder hierarchies with AI agents, create documentation, or simply visualize your project structure in a readable format.

Installation

npm install -g prettify-folder-structure

Usage

The tool supports two commands: format (default) and parse.

Format: Convert plain text to ASCII tree (default)

prettify-folder-structure format <path-to-text-file>
# or simply
prettify-folder-structure <path-to-text-file>

Convert plain indented text into an ASCII tree with box-drawing characters:

Input:

my-react-app/
  src/
    components/
      Button.tsx # Reusable button component
      Header.tsx
      Footer.tsx
    pages/
      Home.tsx # Landing page
      About.tsx
    App.tsx # Main app component
    index.tsx
  package.json

Output:

my-react-app/
├── src/
│   ├── components/
│   │   ├── Button.tsx  # Reusable button component
│   │   ├── Header.tsx
│   │   └── Footer.tsx
│   ├── pages/
│   │   ├── Home.tsx  # Landing page
│   │   └── About.tsx
│   ├── App.tsx  # Main app component
│   └── index.tsx
└── package.json

Parse: Convert ASCII tree back to plain text

prettify-folder-structure parse <path-to-tree-file>

Convert an ASCII tree back to plain indented text:

Input:

my-react-app/
├── src/
│   ├── hooks/           # Custom React hooks
│   │   ├── useAuth.ts
│   │   └── useFetch.ts
│   ├── utils/
│   │   └── helpers.ts   # Utility functions
│   └── App.tsx
└── vite.config.ts

Output:

my-react-app/
  src/
    hooks/ # Custom React hooks
      useAuth.ts
      useFetch.ts
    utils/
      helpers.ts # Utility functions
    App.tsx
  vite.config.ts

Options

Format command:

  • -o, --output <file> - Write output to file instead of stdout

Parse command:

  • -i, --indent <width> - Indentation width: 2 or 4 spaces (default: 2)
  • -o, --output <file> - Write output to file instead of stdout

Examples

# Convert plain text to ASCII tree
prettify-folder-structure structure.txt

# Save ASCII tree to file
prettify-folder-structure format structure.txt -o project-tree.txt

# Convert ASCII tree back to plain text with 4-space indentation
prettify-folder-structure parse project-tree.txt -i 4

# Save plain text to file
prettify-folder-structure parse project-tree.txt -o structure.txt

Input Format

Plain Text Format

Use indentation (2 or 4 spaces) to show hierarchy:

  • Folders end with /
  • Comments use #
  • Consistent indentation required (no tabs)
react-app/
  src/
    App.tsx # Main application
    index.tsx
  public/
    index.html
  package.json

ASCII Tree Format

Box-drawing characters show hierarchy:

  • ├── for items with siblings below
  • └── for last items
  • for vertical lines
  • Folders end with /
  • Comments use #
react-app/
├── src/
│   ├── App.tsx  # Main application
│   └── index.tsx
├── public/
│   └── index.html
└── package.json

Features

  • Bidirectional conversion: Plain text ↔ ASCII tree
  • 📦 Flexible indentation: Auto-detects 2 or 4 space indentation
  • 💬 Inline comments: Preserve # comments in both formats
  • 🎯 Folder detection: Automatically identifies folders vs files
  • 📊 Deep nesting: Handles arbitrarily nested structures
  • Fast: Built with Bun for instant execution
  • 🛡️ Error handling: Clear error messages for invalid input

Development

# Run tests
bun test

# Run directly with Bun
bun index.ts structure.txt

# Run parse command
bun run parse project-tree.txt

Built with Bun - a fast all-in-one JavaScript runtime.