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

@statsmind-ai/baidudisk

v0.1.0

Published

百度网盘 CLI 客户端 — 上传/下载/管理 pan.baidu.com 文件 (基于百度 PCS Web API, 零外部依赖)

Readme

@statsmind-ai/baidudisk

Node.js 实现的百度网盘 CLI 客户端 (零外部依赖, 需 Node.js >= 18)。 基于百度 PCS Web API, 复刻 BaiduPCS-Go 的核心上传/下载/管理逻辑。

安装

npm i -g @statsmind-ai/baidudisk
# 或者本地使用
npx @statsmind-ai/baidudisk <cmd>

快速开始

# 1. 登录 (需从浏览器 pan.baidu.com 请求头里拿到 BDUSS 和 STOKEN)
npx @statsmind-ai/baidudisk login

# 2. 上传
npx @statsmind-ai/baidudisk put ./report.pdf /docs/report.pdf
npx @statsmind-ai/baidudisk put ./mydir /backup/          # 整目录上传
npx @statsmind-ai/baidudisk put ./big.iso /iso/ --parallel 8

# 3. 下载
npx @statsmind-ai/baidudisk get /docs/report.pdf ./
npx @statsmind-ai/baidudisk get /iso/big.iso ./ --parallel 8

# 4. 其他
npx @statsmind-ai/baidudisk ls /
npx @statsmind-ai/baidudisk ls /docs/ --json
npx @statsmind-ai/baidudisk search kernel /
npx @statsmind-ai/baidudisk mkdir /backup/new
npx @statsmind-ai/baidudisk mv /a.txt /b.txt
npx @statsmind-ai/baidudisk cp /a.txt /a-copy.txt
npx @statsmind-ai/baidudisk rm /a.txt
npx @statsmind-ai/baidudisk rm /a.txt -y               # 免确认
npx @statsmind-ai/baidudisk recycle
npx @statsmind-ai/baidudisk restore 123456
npx @statsmind-ai/baidudisk recycleclear 123456 -y
npx @statsmind-ai/baidudisk share /docs --pwd abcd
npx @statsmind-ai/baidudisk shares
npx @statsmind-ai/baidudisk unshare 98765
npx @statsmind-ai/baidudisk offline "magnet:..." /downloads/
npx @statsmind-ai/baidudisk offlist
npx @statsmind-ai/baidudisk who
npx @statsmind-ai/baidudisk quota
npx @statsmind-ai/baidudisk logout

登录凭证获取

  1. 浏览器打开 https://pan.baidu.com 并登录
  2. F12 → Network → 刷新 → 点任意一个请求
  3. 在 Request Headers 里复制完整 Cookie 串
  4. 确认串中同时包含 BDUSS=... 和 STOKEN=...
  5. 执行 npx @statsmind-ai/baidudisk login 并粘贴

或使用非交互方式:

npx @statsmind-ai/baidudisk login --bduss "..." --stoken "..."
npx @statsmind-ai/baidudisk login --cookies "BDUSS=...; STOKEN=..."

命令速查

| 命令 | 说明 | | --- | --- | | login / logout / accounts / who | 账号管理 | | quota | 容量 | | ls / info / search | 浏览 | | mkdir / rm / mv / cp | 基础文件操作 | | recycle / restore / recycleclear | 回收站 | | put / get | 上传/下载 | | share / shares / unshare | 分享 | | offline / offlist | 离线下载 |

上传特性

  • 秒传探测 (precreate): 服务端已有相同 md5 文件时瞬间完成
  • 分片并发 (superfile2): 4MB / 16MB / 64MB 按大小自适应, 默认 4 并发
  • 重名策略 --policy: overwrite (默认) / skip / rsync

下载特性

  • locatedownload + Range 并发: 8MB 一块, 默认 4 并发
  • 断点续传: 中断后重跑会检测 .part 文件继续
  • dlink 失效自动刷新

多账号

npx @statsmind-ai/baidudisk login --account work --cookies "..."
npx @statsmind-ai/baidudisk -a work ls /
npx @statsmind-ai/baidudisk -a work put ./x /y
npx @statsmind-ai/baidudisk accounts
npx @statsmind-ai/baidudisk logout -a work

账号存储在 ~/.config/baidudisk/accounts.json (可用 BAIDUDISK_HOME 覆盖)。

限制

  • 单文件下载 (目录递归下载未实现, 请用 ls 枚举后自行 get)
  • 未实现: 转存分享链接到自己网盘 (share 只创建, 不消费)
  • STOKEN 有效期有限, 过期后需重新 login
  • 非 SVIP 账号上传/下载会被百度限速

开发

git clone <repo>
cd baidudisk
npm test            # 本地冒烟测试 (不依赖登录)
node bin/baidudisk.js help