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

bat-mkdir-cli

v0.1.1

Published

Node.js CLI like `bat` — cat with syntax highlighting, line numbers + mkdir -p + project scaffolding. Cross-platform, fast, zero-config.

Downloads

75

Readme

bat-mkdir-cli

Node.js CLI like bat — cat with syntax highlighting + mkdir -p + project scaffolding.
Cross-platform, fast, zero-config. Inspired by bat (cat with wings) and mkdir -p.

npm version node license

中文 · English


中文

特性

  • 类 bat 的 cat:行号、语法高亮(JS/TS/Py/JSON/MD/YAML/Shell)、多文件串联、表头
  • 类 mkdir -p:递归创建、verbose、dry-run、octal mode
  • 项目脚手架:bat init <dir> --template basic|node-cli 一键创建带 package.json/README/.gitignore 的标准项目
  • 跨平台:Windows / macOS / Linux,自动展开 ~ 与 %VAR% / $VAR
  • 高性能:纯 ESM,零重依赖(仅 commander + chalk),bench 显示 10k 目录创建 < 1s,1MB 文件高亮 < 20ms

安装

npm i -g bat-mkdir-cli
# 或
npx bat-mkdir-cli --help

提供 3 个 bin:bat、bat-mkdir、bmk(短别名)。

快速开始

# 1. 类 bat 查看文件(行号+高亮)
bat README.md
bat --plain src/index.js
bat cat --no-number package.json

# 2. 创建目录(等同 mkdir -p)
bat mkdir -v a/b/c  d/e/f
bat mkdir --dry-run tmp/demo

# 3. 脚手架
bat init my-app --template basic -v
bat init my-cli --template node-cli
bat templates          # 查看可用模板

# 4. 性能测试
bat bench

CLI 帮助

Usage: bat [options] [command] [files...]

Options:
  -v, --version   output version
  -h, --help      display help

Commands:
  cat|c <files...>         display file(s) with line numbers and highlighting
  mkdir|mk <dirs...>       create directories recursively
  init|create <dir>        scaffold a new project
  templates                list available project templates
  bench                    run micro-benchmark

cat

bat cat file.js              # 行号+高亮
bat cat --plain file.js      # 纯文本
bat cat --no-number file.js  # 无行号
bat cat a.js b.py            # 多文件(带表头)

mkdir

bat mkdir -v a/b/c
bat mkdir --dry-run x/y/z    # 预演
bat mkdir -m 755 secure/dir

init

bat init my-app                       # basic 模板
bat init my-app -t node-cli --force   # 强制覆盖
bat init my-app --name awesome-app -v

模板变量 {{name}} {{description}} {{author}} {{year}} 自动渲染。

模板

| 模板 | 说明 | 包含文件 | |------|------|----------| | basic | 极简项目 | package.json, README.md, index.js, .gitignore | | node-cli | Node CLI 脚手架 | package.json, README.md, bin/cli.js, .gitignore |

性能

npm run bench 在 bench/bench.js 中:

  • 1000 次 mkdir -p 嵌套目录
  • 100 次 1MB 文件高亮
  • 1000 次 expandPath + getLanguage

示例(Windows i7, Node 24):

mkdir 1000x : 320 ms (0.32 ms/op)
cat highlight 100x 1MB : 980 ms (9.8 ms/op)
utils 1000x : 12 ms

API

import { mkdir, catFiles, initProject } from 'bat-mkdir-cli';

await mkdir(['a/b/c'], { verbose: true });
await catFiles(['README.md'], { number: true });
await initProject('my-app', { template: 'basic' });

详见 docs/API.md 与 docs/USAGE.md。


English

Same as above — see docs/USAGE.md.

Why bat-like?

bat is a Rust cat clone with syntax highlighting. This project brings the same ergonomics to Node.js plus mkdir -p and scaffolding, so Windows users can bat file without WSL and bat mkdir works everywhere.

License

MIT © Clearzero22


Development

git clone https://github.com/Clearzero22/bat-mkdir-cli.git
cd bat-mkdir-cli
npm install
npm test
npm run bench
npm pack --dry-run