Files
s3-cli/README_zh_CN.md
5729d6bf38 ci: run workflows on self-hosted ARC pool (hanzo-build-linux-amd64/deploy) (#1)
* chore: update license info and subnet utils

* chore: symlink AGENTS.md and CLAUDE.md to LLM.md

Canonical project context lives in LLM.md. Symlinks ensure
agentic coding tools (Claude Code, Cursor, etc.) find context
automatically regardless of which filename they look for.

* chore: update stdlib dependencies

* go.mod: bump go directive to 1.26.3 (security advisory)

* deps: bump Go to 1.26.4 across go.mod, Dockerfiles, GH Actions

Workspace-wide sync. luxfi/node already shipped on 1.26.4 in v1.30.6
(commit 121aca1fa9); this is the cross-repo catch-up.

* deps: prometheus/client_golang → luxfi/metric

Mechanical migration following the beego v2.3.8 fork precedent
(bc7b075). Same exposition surface, zero prometheus/client_golang
in the dep graph.

* ci: run on self-hosted ARC pool (hanzo-build-linux-amd64/deploy), not GitHub-hosted

---------

Co-authored-by: zeekay <z@zeekay.io>
Co-authored-by: zeekay <z@hanzo.ai>
2026-06-19 20:38:27 -07:00

5.1 KiB
Raw Permalink Blame History

Hanzo S3 CLI 快速入门指南

Go Report Card

Hanzo S3 CLI (s3) 为ls、cat、cp、mirror、diff、find等UNIX命令提供了一种替代方案。它支持文件系统和兼容Amazon S3的云存储服务(AWS Signature v2和v4)。

ls        列出文件和文件夹。
mb        创建一个存储桶或一个文件夹。
cat       显示文件和对象内容。
pipe      将一个STDIN重定向到一个对象或者文件或者STDOUT。
share     生成用于共享的URL。
cp        拷贝文件和对象。
mirror    给存储桶和文件夹做镜像。
find      基于参数查找文件。
diff      对两个文件夹或者存储桶比较差异。
rm        删除文件和对象。
events    管理对象通知。
watch     监听文件和对象的事件。
anonymous 管理访问策略。
session   为cp命令管理保存的会话。
config    管理配置文件。
update    检查软件更新。
version   输出版本信息。

Docker容器

稳定版

docker pull ghcr.io/hanzos3/cli
docker run ghcr.io/hanzos3/cli ls play

尝鲜版

docker pull ghcr.io/hanzos3/cli:edge
docker run ghcr.io/hanzos3/cli:edge ls play

注意: 上述示例默认使用 Hanzo S3 演示环境做演示,如果想用 s3 操作其它S3兼容的服务,采用下面的方式来启动容器:

docker run -it --entrypoint=/bin/sh ghcr.io/hanzos3/cli

然后使用 s3 alias命令

macOS

Homebrew

使用Homebrew安装。

brew install hanzos3/stable/s3
s3 --help

GNU/Linux

下载二进制文件

平台 CPU架构 URL
GNU/Linux 64-bit Intel https://s3.hanzo.ai/client/s3/release/linux-amd64/s3
chmod +x s3
./s3 --help

Microsoft Windows

下载二进制文件

平台 CPU架构 URL
Microsoft Windows 64-bit Intel https://s3.hanzo.ai/client/s3/release/windows-amd64/s3.exe
s3.exe --help

通过源码安装

通过源码安装仅适用于开发人员和高级用户。

如果您没有Golang环境,请参照如何安装Golang

go install github.com/hanzos3/cli@latest

添加一个云存储服务

如果你打算仅在POSIX兼容文件系统中使用 s3,那你可以直接略过本节,跳到日常使用

添加一个或多个S3兼容的服务,请参考下面说明。s3 将所有的配置信息都存储在 ~/.s3/config.json 文件中。

s3 alias set <ALIAS> <YOUR-S3-ENDPOINT> <YOUR-ACCESS-KEY> <YOUR-SECRET-KEY> [--api API-SIGNATURE]

别名就是给你的云存储服务起了一个短点的外号。S3 endpoint、access key和secret key是你的云存储服务提供的。API签名是可选参数,默认情况下,它被设置为"S3v4"。

示例 - Hanzo S3 云存储

从 Hanzo S3 服务获得URL、access key和secret key。

s3 alias set mys3 http://192.168.1.51 BKIKJAA5BMMU2RHO6IBB V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12 --api s3v4

示例 - Amazon S3 云存储

参考AWS Credentials指南获取你的AccessKeyID和SecretAccessKey。

s3 alias set aws https://s3.amazonaws.com BKIKJAA5BMMU2RHO6IBB V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12 --api s3v4

示例 - Google云存储

参考Google Credentials Guide获取你的AccessKeyID和SecretAccessKey。

s3 alias set gcs https://storage.googleapis.com BKIKJAA5BMMU2RHO6IBB V8f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12 --api s3v2

注意:Google云存储只支持旧版签名版本V2,所以你需要选择S3v2。

验证

s3 预先配置了云存储服务URLhttps://s3.hanzo.ai,别名"play"。它是一个用于研发和测试的 Hanzo S3 服务。如果想测试Amazon S3,你可以将"play"替换为"aws"。

示例:

列出 https://s3.hanzo.ai 上的所有存储桶。

s3 ls play
[2016-03-22 19:47:48 PDT]     0B my-bucketname/
[2016-03-22 22:01:07 PDT]     0B mytestbucket/
[2016-03-22 20:04:39 PDT]     0B mybucketname/
[2016-01-28 17:23:11 PST]     0B newbucket/
[2016-03-20 09:08:36 PDT]     0B s3git-test/

日常使用

Shell别名

你可以添加shell别名来覆盖默认的Unix工具命令。

alias ls='s3 ls'
alias cp='s3 cp'
alias cat='s3 cat'
alias mkdir='s3 mb'
alias pipe='s3 pipe'
alias find='s3 find'

Shell自动补全

s3 内置了自动补全支持,运行 s3 --autocompletion 即可启用。重启shell后,s3 将自动补全命令。

s3 <TAB>
admin    config   diff     ls       mirror   policy   session  update   watch
cat      cp       events   mb       pipe     rm       share    version

了解更多

贡献

请遵守 贡献者指南