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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@ipget/tree-gen

v0.5.2

Published

Generate folder structure from ASCII tree

Downloads

7

Readme

tree-gen

Generate folder and file structures from ASCII tree diagrams. Perfect for quickly scaffolding project structures from documentation or planning notes.

Installation

Install globally via npm:

npm install -g @ipget/tree-gen

Usage

From a file

tree-gen structure.txt

Interactive mode (paste directly)

tree-gen -i
# Paste your tree structure, then press Ctrl+D (Unix/Mac) or Ctrl+Z (Windows)

Dry run (preview without creating)

tree-gen -d structure.txt
tree-gen -i -d

Help

tree-gen --help

Tree Format

tree-gen supports standard ASCII tree format with box-drawing characters:

  • Folders: End with a trailing slash /
  • Files: Have an extension or no extension
  • Box characters: ├──, , └── (automatically parsed)

Example Tree

project/
├── src/
│   ├── components/
│   │   ├── Header.js
│   │   └── Footer.js
│   ├── utils/
│   │   └── helpers.js
│   └── index.js
├── public/
│   └── index.html
├── package.json
└── README.md

Creating this structure

Save the tree to a file structure.txt and run:

tree-gen structure.txt

Or use interactive mode:

tree-gen -i
# Paste the tree above, press Ctrl+D

Output

✓ Created folder: project/
✓ Created folder: project/src/
✓ Created folder: project/src/components/
✓ Created file: project/src/components/Header.js
✓ Created file: project/src/components/Footer.js
✓ Created folder: project/src/utils/
✓ Created file: project/src/utils/helpers.js
✓ Created file: project/src/index.js
✓ Created folder: project/public/
✓ Created file: project/public/index.html
✓ Created file: project/package.json
✓ Created file: project/README.md

Summary:
Folders: 5
Files: 7

Options

| Option | Description | |--------|-------------| | -i, --interactive | Enter interactive mode to paste tree structure | | -d, --dry-run | Preview the structure without creating files/folders | | --help | Show help message |

Features

  • ✅ Zero dependencies (only Node.js built-ins)
  • ✅ Works with standard ASCII tree format
  • ✅ Automatically detects folders (trailing /) and files
  • ✅ Creates nested directory structures
  • ✅ Skips existing files/folders
  • ✅ Dry-run mode for safe previewing
  • ✅ Interactive mode for pasting trees directly
  • ✅ Cross-platform (Windows, Mac, Linux)

Tips

  1. Copy from documentation: Many projects display their structure as ASCII trees - copy and paste directly!

  2. Generate from tree command: On Unix systems, you can use the tree command output:

   tree -F > structure.txt
   tree-gen structure.txt
  1. Mix files and folders: Files can have extensions, no extensions, or be explicitly marked

  2. Flexible formatting: Works with various indentation styles and box characters

Examples

Simple project structure

app/
├── src/
│   └── main.js
└── tests/
    └── test.js

Frontend project

my-app/
├── public/
│   ├── favicon.ico
│   └── index.html
├── src/
│   ├── App.js
│   ├── index.js
│   └── styles.css
├── package.json
└── README.md

API project

api/
├── controllers/
│   ├── userController.js
│   └── authController.js
├── models/
│   └── User.js
├── routes/
│   └── api.js
├── config/
│   └── database.js
├── server.js
└── .env

Requirements

  • Node.js >= 14.0.0

License

MIT

Contributing

Contributions welcome! Please open an issue or submit a pull request on GitHub.

Author

Of the North

Support

If you encounter any issues or have questions, please open an issue.


## **Publishing to npm**

### 1. Update package.json

Replace `yourusername` with your actual GitHub username and update the author field.

### 2. Create .gitignore

node_modules/ .DS_Store *.log