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

ftmap

v1.0.11

Published

tool like tree command

Readme

ftmap

基于 directory-tree ,生成文件目录的树形结构展示

install

npm install ftmap -g

Example

1、无文件夹和文件标记区分

ftmap -L 3  -I "/node_modules|\.git/"
├──assets
│   ├──scripts
│   └──styles
├──dist
├──src
│   ├──components
│   ├──pages
│   ├──plugins
│   ├──services
│   ├──index.tsx
│   └──main.ts
├──package-lock.json
└──package.json

2、标记文件夹和文件

ftmap -L 3  -I "/node_modules|\.git/" -T
├──[D] assets
│   ├──[D] scripts
│   └──[D] styles
├──[D] dist
├──[D] src
│   ├──[D] components
│   ├──[D] pages
│   ├──[D] plugins
│   ├──[D] services
│   ├──[F] index.tsx
│   └──[F] main.ts
├──[F] package-lock.json
└──[F] package.json

3、带根目录文件夹

ftmap -L 3  -I "/node_modules|\.git/" -R -T
[Root] demo
--------------------------------------------
├──[D] assets
│   ├──[D] scripts
│   └──[D] styles
├──[D] dist
├──[D] src
│   ├──[D] components
│   ├──[D] pages
│   ├──[D] plugins
│   ├──[D] services
│   ├──[F] index.tsx
│   └──[F] main.ts
├──[F] package-lock.json
└──[F] package.json

Options

Usage: ftmap [options]

选项:
      --version  显示版本号                                               [布尔]
  -I, --pattern  需要排除的文件目录正则表达式(注意引号)
                 eg. "/node_modules|.git/"
  -L, --level    文件目录结构的展示层级
  -T, --tag      是否展示文件类型
  -O, --output   内容输出地址,默认为控制台打印
  -N, --nature   使用系统自然顺序,若不设置则默认显示为目录-文件的排序方式
  -R, --root     是否显示根目录
  -h, --help     显示帮助信息                                             [布尔]

Document

getFileTree(options)

options默认值定义

/**
 * 默认配置
 * @typedef {{output: null, level: number, nature: boolean, targetDirectory: *, root: boolean, pattern: string, tag: boolean}}
 * @type {BaseConfig}
 */
const baseConfig = {
    targetDirectory: process.cwd(),     // 待查看目录
    pattern: '',                        // 排除的文件
    level: Infinity,                    // 输出的层级
    tag: false,                         // 是否展示文件类型
    output: null,                       // 结果输出地址
    nature: false,                      // 是否为系统文件及文件夹的默认排序
    root: false                         // 是否展示根目录
};

使用示例

import ftmap from 'ftmap';

ftmap.getFileTree({
    targetDirectory: path.resolve(__dirname, "../src"),
    pattern: /node_modules|.git|.history/, // 排除的文件
    level: 3, // 输出的层级
    tag: true, // 是否展示文件类型
    output: null,
    nature: false,
    root: false
});