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

gftjs

v0.0.1-alpha

Published

Generate a file Structure for a folder

Downloads

2

Readme

# gft.js

> **Get File Tree (gft.js)** is a lightweight CLI tool and Node.js API for generating a plain-text file tree of a given folder or directory. It provides a clean, customizable output with options to include emojis and line numbers. When run in the terminal, it enhances the display using [chalk](https://www.npmjs.com/package/chalk) for color and [log-symbols](https://www.npmjs.com/package/log-symbols) for status icons.

---

## Features

- **CLI & API:** Use gft.js as a standalone command-line tool or integrate it into your own Node.js projects.
- **Plain-Text Output:** Generates a plain-text file tree that is ideal for saving to files or further processing.
- **Customizable Options:** Toggle emoji icons and line numbers with simple command-line flags.
- **Enhanced Terminal Display:** When printing to the terminal, directories and status messages are colorized for a polished look.
- **ASCII Art Banner:** Each CLI run displays an eye-catching ASCII art header along with the package version.

---

## Installation

### Global Installation

Install gft.js globally using npm so that you can use the `gft` command anywhere:

```bash
npm install -g gft.js

Local Installation

Alternatively, install it as a dependency in your project:

npm install gft.js

Usage

Command-Line Interface (CLI)

After installing globally, you can run gft.js from the terminal. Below are some examples:

  • Basic Usage:

    gft ./my-folder
  • With Options:

    • Disable emojis: --no-emoji or --icon=false
    • Include line numbers: --line-numbers
    • Save output to a file: --output=output.txt

    Example:

    gft ./my-folder --line-numbers --output=tree.txt

When no output file is specified, the CLI prints the file tree to the terminal with colorized directories and an ASCII art header.

API Usage

You can also use gft.js programmatically in your Node.js projects:

const { generateFileTree } = require('gft.js');

const tree = generateFileTree('./my-folder', { showEmoji: true, showLineNumbers: false });
console.log(tree);

The generateFileTree function returns a plain-text representation of your folder’s structure.


Example Output

When run without specifying an output file, the CLI displays an ASCII art banner along with the file tree. For example:


  ▄████   █████▒▄▄▄█████▓      ▄▄▄██▀▀▀██████
 ██▒ ▀█▒▓██   ▒ ▓  ██▒ ▓▒        ▒██ ▒██    ▒
▒██░▄▄▄░▒████ ░ ▒ ▓██░ ▒░        ░██ ░ ▓██▄
░▓█  ██▓░▓█▒  ░ ░ ▓██▓ ░      ▓██▄██▓  ▒   ██▒
░▒▓███▀▒░▒█░      ▒██▒ ░  ██▓  ▓███▒ ▒██████▒▒
 ░▒   ▒  ▒ ░      ▒ ░░    ▒▓▒  ▒▓▒▒░ ▒ ▒▓▒ ▒ ░
  ░   ░  ░          ░     ░▒   ▒ ░▒░ ░ ░▒  ░ ░
░ ░   ░  ░ ░      ░       ░    ░ ░ ░ ░  ░  ░
      ░                    ░   ░   ░       ░
                           ░

⚠ v0.0.1-alpha

📁 my-folder/
├── 📜 file1.js
├── 📁 sub-folder/
│   ├── 🐍 script.py
│   └── 📑 document.pdf
└── 🎬 video.mp4

Note: The output above is shown with colorized directories in the terminal.


Contributing

Contributions are welcome! If you have suggestions or improvements, please submit issues or pull requests in the GitHub repository.