命令行工具
从终端上传。单条命令,脚本用 JSON 输出,支持大文件断点续传。源码见 GitHub。
安装
Homebrew(macOS 和 Linux)
brew install storageto/tap/storageto
Go
go install github.com/storageto/cli/cmd/storageto@latest
确保 ~/go/bin 在你的 PATH 中。
预编译二进制文件
从 GitHub 发布页 下载对应的压缩包(macOS ARM/Intel,Linux ARM/Intel)。
使用方法
单个文件
storageto upload photo.jpg
URL: https://storage.to/FQxyz1234
Raw: https://storage.to/r/FQxyz1234
Size: 2.1 MB
Expires: 2026-04-15T12:00:00Z
多个文件
传入多个路径或通配符,会自动归为一个合集:
storageto upload file1.txt file2.txt file3.txt
storageto upload *.log
storageto upload src/**/*.go
大文件
超过 5 GB 的文件会自动分块并行上传,支持断点续传。进度会实时显示:
1.2 GB / 10.0 GB (12.0%)
按 Ctrl+C 取消 — 部分上传会自动在服务器清理。
参数
| 参数 | 描述 |
|---|---|
-c, --collection | 即使是单个文件也强制创建合集。 |
-v, --verbose | 显示详细的进度信息。 |
--json | 输出 JSON 结果(机器可读,适合脚本)。 |
--no-token | 完全匿名上传 — 不读取或写入身份令牌文件。 |
--api <url> | 覆盖 API 端点(默认为 https://storage.to)。 |
-h, --help | 显示帮助。 |
JSON 输出
storageto upload photo.jpg --json
{
"url": "https://storage.to/FQxyz1234",
"raw_url": "https://storage.to/r/FQxyz1234",
"filename": "photo.jpg",
"size": 2202009,
"human_size": "2.1 MB",
"expires_at": "2026-04-15T12:00:00Z"
}
身份令牌
CLI 首次使用时会存储一个随机的 访客令牌,因此同一台机器的重复上传共享配额和归属。这不是账户登录,只是每台机器的标识符。
| 操作系统 | 路径 |
|---|---|
| macOS | ~/Library/Application Support/storageto/token |
| Linux | ~/.config/storageto/token |
| Windows | %AppData%\storageto\token |
传入 --no-token 可完全跳过令牌文件。
脚本使用
将 --json 输出通过管道传给 jq 提取链接:
URL=$(storageto upload build.zip --json | jq -r '.url')
echo "Uploaded to $URL"
版本与更新
storageto version
Homebrew 用户:使用 brew upgrade storageto。Go 用户:使用最新标签重新运行 go install。