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

file-go

v1.0.7

Published

本程序使用 windows 平台的一些工具进行文件的复制、备份、迁移。支持使用通配符排除不需要的文件。

Readme

file-go

本程序使用 windows 平台的一些工具进行文件的复制、备份、迁移。支持使用通配符排除不需要的文件。若要获得更多的文件访问权限,建议使用管理员身份运行。

# 安装
npm i -g file-go

# 查看使用说明
file-go --help

命令和参数

  • size -- 分析磁盘空间使用情况; 无参智能分析会先做占用预检, 未占用目录优先扫描并逐条输出大小与占用状态

    • 无参时默认走「智能白名单分析」: 扫描家目录下的常见膨胀目录(Downloads/Documents/Desktop/Videos/Pictures, Windows 额外 AppData, POSIX 额外 ~/.cache 等), 按大小排序, 标注适合 link 的目录并给出 link 命令
    • file -- 精确扫描指定目录, 多个使用逗号分割(与无参智能分析互斥)
    • add -- 智能分析模式下追加的自定义扫描目录, 多个使用逗号分割
    • minSize -- 扫描大小阈值(MB), 小于此值的目录不进结果; 默认: 100; 传 0 关闭过滤
    • noCache -- 禁用扫描结果缓存, 强制重新扫描; 默认: false(默认缓存, 相同目录下次直接复用)
    • plain -- 无参时强制只扫当前目录(逃生口, 不走智能分析), 默认: false
    • depth -- 目录深度, 默认: 1
    • top -- 输出条目数, 默认: 30
  • crush -- 粉碎标记为已删除的文件

    • file -- 同上, 默认为当前目录
  • sdelete -- 删除当前存在的文件并粉碎它

    • file -- 同上, 默认为当前目录
  • handle -- 查看目录占用情况

    • file -- 同上, 默认为当前目录
  • link -- 保持原来的文件引用关系的情况下移动目录

    • file -- 同上, 无默认值, 必须指定此参数
    • out -- 要输出的目的地址, 默认: ./store; auto 模式下若未传 out, Windows 自动选择剩余空间最大盘(排除源目录所在盘)下的 link 目录
    • force -- 目录被占用时强制解除(关闭占用句柄, 基于 handle64 -c), 避免弹 GUI 手动解锁, 默认: false; 需管理员身份运行
    • auto -- 自动扫描迁移模式: 扫描候选目录(file 指定根的直接子目录; 无 file 走智能白名单, 与 size 一致), 对未占用且大小达 minSize 的目录自动迁移; 默认: false
    • apply -- auto 模式下真实执行迁移; 默认: false(仅 dry-run 预览: 打印将迁移清单与等效 link 命令, 不改动文件系统、不写日志)
    • add -- auto 白名单模式下追加的扫描根, 多个使用逗号分割(同 size 的 add)
    • minSize -- auto 候选大小阈值(MB), 小于此值的目录不迁移; 默认: 100; 传 0 关闭过滤(同 size)
  • unlink -- 取消链接,恢复文件到原始位置

    • file -- log.link.json 文件路径, 必须指定此参数
    • select -- 要恢复的文件路径, 与日志中的 file 参数进行匹配, 多个使用逗号分割, 必须指定此参数
    • force -- 同 link, 目录被占用时强制解除, 默认: false; 需管理员身份运行
    • clean -- 智能清理已恢复的条目, 默认: false
      • 清理 select 参数匹配的条目对应的存储目录
      • 从日志文件中移除已成功恢复的条目
      • 如果所有条目都已恢复, 则删除整个日志文件
  • copy -- 复制目录到指定位置

    • file -- 同上, 无默认值, 必须指定此参数
    • out -- 同上
    • ignore -- 要忽略的文件或目录, 支持通配符, 多个使用逗号分割, 默认: node_modules*,httpData*,.history,*-cache,.cache,cache
    • noIgnore -- 不忽略任何文件
  • zip -- 压缩目录到指定位置

    • file -- 同上, 默认为当前目录
    • out -- 同上
    • ignore -- 同上
    • noIgnore -- 同上
    • v -- 分卷大小, 传 false 为不使用分卷, 默认: 1g
    • p -- 使用密码, 默认为空
    • mx -- 配置压缩等级, 0 为不压缩, 0-9, 默认: 0

示例

:: 备份为 zip 包
:: 假设你想把一些文件压缩为一个 zip 包保存起来(要访问时需要解压缩),可以使用此方法。压缩后可以上传到云盘之类的地方。
:: 把一些目录压缩到一个 D:/store.zip 文件中, 密码为 123
file-go zip file=C:/temp,D:/temp out=D:/store p=123

:: 迁移
:: 智能分析家目录下占用较大、适合迁移的目录, 报告末尾会给出可直接执行的 link 命令
file-go size
:: 也可精确扫描指定目录
file-go size file=C:/temp
:: 当你的某个分区空间不足,你想一些占用空间较大的目录移动到其他分区时,例如想应用程序数据同时又不影响程序使用时,可以使用此方法。
:: 保持原来的文件引用关系的情况下, 转移一些目录到 D:/store 中
file-go link file=C:/temp,D:/temp out=D:/store
:: 当目录被其他进程占用导致迁移失败时, 加 force 强制解除占用(需管理员), 避免手动在弹窗里点 Unlock
file-go link file=C:/temp,D:/temp out=D:/store force=true
:: 自动迁移(一边扫描一边自动迁移未占用的符合条件的目录)
:: 先 dry-run 预览: 扫描 C:/temp 的子目录, 列出将迁移的目录与等效命令, 不实际改动
file-go link auto file=C:/temp out=D:/store
:: 确认无误后加 apply=true 真实迁移(逐个串行, 单目录失败会跳过并继续)
file-go link auto apply=true file=C:/temp out=D:/store
:: 不传 file 则扫描智能白名单(家目录下常见膨胀目录的子目录); 大小阈值与排除规则同 size
file-go link auto apply=true minSize=500 out=D:/store
:: auto 模式不传 out 时, Windows 自动选剩余空间最大的盘(排除源盘)的 /link 作为存储目录
file-go link auto apply=true file=C:/temp

:: 取消链接
:: 当你需要恢复之前使用 link 命令转移的目录时,可以使用此方法。
:: 恢复指定的链接(保留存储文件和日志)
file-go unlink file=D:/store/log.link.json select=C:/test
:: 恢复多个指定的链接
file-go unlink file=D:/store/log.link.json select=C:/test,D:/temp
:: 恢复链接并智能清理(只清理已恢复的条目)
file-go unlink file=D:/store/log.link.json select=C:/test clean=true
:: 注意: clean 参数只会清理 select 参数匹配且成功恢复的条目, 未匹配的条目会保留在日志文件中

:: 复制
:: 假设你想把一些文件复制到某个地方,由于需要经常访问,则不使用压缩,例如视频、照片,可以使用此方法。
:: 复制一些目录到 D:/store 目录下
file-go copy file=C:/temp,D:/temp out=D:/store

todo

  • [ ] 支持使用 cipher 擦除删除的数据
  • [ ] 支持 unzip 命令, 用于解压 zip 文件
  • [ ] 支持 sync 命令, 用于同步文件
  • [ ] 支持 linux 平台
  • [ ] 支持 copy link 模式
    • 即复制时移除临时文件后,再创建连接。可用于移动前端项目,由于前端项目的 node_modules 文件量大,迁移慢,并且迁移后也无法使用,所以不如跳过它,在需要时重新安装。