COSCLI

COSCLI 1.0.9

COS provides the command-line client COSCLI to allow you to upload, download, delete, and perform other operations on COS objects by using simple commands.

  • By Tencent Cloud
  • Open Source
  • Updated Aug 25, 2026
Download for Windows

About COSCLI

COS provides the command-line client COSCLI to allow you to upload, download, delete, and perform other operations on COS objects by using simple commands.

What's new in 1.0.9

COSCLI v1.0.9 迭代改动点
一、新增能力
1. 新增 stat 命令(查询对象元数据)
- 新增文件:cmd/stat.go、util/stat.go
- 功能:通过 HEAD Object 接口查询对象元数据,输出 ETag、Content-Type、Content-Length、Last-Modified、Cache-Control、Content-Disposition、Content-Encoding、Content-Language、Expires、存储类型、版本号、对象类型、CRC64,以及全部自定义元数据 x-cos-meta-*。
- 用法:
- ./coscli stat cos://bucket-1234567890/test.txt
- ./coscli stat cos://bucket-1234567890/test.txt --version-id <version-id>
- 参数:--version-id 指定查询的对象版本。
2. 自定义域名支持写入配置文件(Bucket 级 customized)
- util/types.go:Bucket 结构体新增 Customized bool 字段(yaml: customized)。
- cmd/config_add.go:新增 --customized flag,可在添加桶时持久化自定义域名标记。
- cmd/config_init.go:交互式初始化时新增询问「是否对该桶使用自定义 endpoint」。
- cmd/config_show.go:展示桶的 Customized 字段。
- util/url.go GenURL:URL 生成时 --customized 命令行参数优先,未指定则回退到配置文件中桶的 customized 字段。
3. 新增列举存储桶的 Service 域名配置(ServiceDomain)
- util/types.go:Base 结构体新增 ServiceDomain string(yaml: servicedomain)。
- util/const.go:新增默认常量 CosServiceDomain = "service.cos.myqcloud.com"。
- cmd/config_set.go:新增 --service_domain flag(@ 可清空)。
- cmd/config_init.go:初始化时新增询问默认 service 域名。
- cmd/config_show.go:展示 ServiceDomain。
- util/url.go GenBaseURL:始终显式构造 ServiceURL,不再返回 nil,避免 SDK 回退到写死的 http://service.cos.myqcloud.com。优先级:命令行 --endpoint > 配置文件 base.servicedomain > 默认 service.cos.myqcloud.com。
4. 新增代理(Proxy)支持
- util/types.go:Base 新增 Proxy string(yaml: proxy);Param 新增 Proxy string。
- cmd/config_set.go:新增 --proxy flag(@ 可清空)。
- cmd/config_show.go:展示 Proxy。
- cmd/root.go:新增全局持久化参数 --proxy,支持 http://user:[email protected]:8080、socks5://127.0.0.1:1080 等。
- util/client.go:新增 getProxyFunc,优先级 命令行 --proxy > 配置文件 base.proxy;对 URL 校验 scheme 与 host,非法输入回退为不使用代理并打印 warning;Service 客户端与 Bucket 客户端均注入代理。
5. signurl 支持 PUT(上传预签名 URL)
- cmd/signurl.go:新增 --method / -m flag(默认 GET),支持 GET(下载)与 PUT(上传);对非 GET/PUT 的 method 报错。
- 短描述更新为 "Gets the signed URL for upload or download"。
6. restore 并发重构 + 进度显示
- util/restore_objects.go 大幅重构:
- 用 restoreCounter(sync/atomic)替代包级全局计数器 succeedNum/failedNum/errTypeNum,消除多次调用间的状态残留,保证并发安全。
- 引入 worker pool(taskCh + sync.WaitGroup):list 阶段生产 restoreTask,多个 worker 并发执行 HEAD/POST restore。
- list 与回热解耦:produceCosRestoreTasks / produceOfsRestoreTasks 只负责扫描并投递任务,回热逻辑集中在 worker。
- 新增单行刷新的进度条(restoreProgressLoop):list 未结束时按已完成数展示,list 结束后切换为百分比。
- cmd/restore.go 新增 --routines flag(默认 3,范围 1~10000),批量 restore 时的并发数。
- cmd/restore.go 单对象 restore 遇到 HTTP 409(对象已在回热中)视为提交成功,不再报错。

二、性能/并发优化

  • 分片并发线程数推导重写(util/helper.go getThreadNumByPartSize) …

Full release notes »

Technical details

PublisherTencent Cloud
AuthorTencent Cloud Computing(Beijing) Company Limited
Version1.0.9
Release date2026-08-25
LicenseApache-2.0
Installer typeportable
Architecturex64
Package IDTencent.COSCLI

Links & install command

Install COSCLI from the command line with Windows Package Manager (winget):

winget install --id=Tencent.COSCLI -e

costencent-cloud

Older versions

  • 1.0.8
  • 1.0.7
  • 1.0.6
  • 1.0.5
  • 1.0.4
  • 1.0.3
  • 1.0.2
  • 1.0.1
  • 0.20.0-beta