@pengpeng42/pi-file-stats
A Pi extension for recursive directory file statistics
Package details
Install @pengpeng42/pi-file-stats from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@pengpeng42/pi-file-stats- Package
@pengpeng42/pi-file-stats- Version
1.0.0- Published
- Nov 1, 2026
- Downloads
- 292/mo · 292/wk
- Author
- pengpeng42
- License
- ISC
- Types
- extension
- Size
- 3.9 KB
- Dependencies
- 0 dependencies · 2 peers
Pi manifest JSON
{
"extensions": [
"./extensions/file-stats.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
# pi-file-stats
一个用于统计目录文件信息的 Pi 扩展。
## 功能
- 递归统计目录及子目录中的文件。
- 返回文件总数、总字节数和各扩展名的文件数量。
- 跳过符号链接。
- 无扩展名的文件归入 (no extension)。
## 本地试用
在包目录中运行:
pi -e .
进入 Pi 后输入:
请调用 file\_stats 工具,统计 ./stats-demo 目录。
stats-demo 是测试目录,使用时可替换成自己的目录路径。
## 工具参数
- directory:需要统计的目录,支持绝对路径或相对于 Pi 当前工作目录的路径。
## 返回字段
- directory:实际统计的目录。
- fileCount:文件总数。
- totalBytes:文件总字节数。
- byExtension:各扩展名对应的文件数量。
## 测试记录
在 Windows PowerShell、Pi 1.3.0 环境下完成测试。
测试目录包含两个 txt 文件和子目录中的一个 md 文件。
返回结果为 3 个文件、12 字节,与预期一致。