name: agentuity-cli-cloud-storage-upload description: 上传文件到存储桶。需要身份验证。用于Agentuity云平台操作 version: “0.0.103” license: Apache-2.0 allowed-tools: “Bash(agentuity:*)” argument-hint: “<name> <filename>” metadata: command: “agentuity cloud storage upload” tags: “write requires-auth”
云存储上传
上传文件到存储桶
前提条件
- 已通过
agentuity auth login进行身份验证 - 需要组织上下文(
--org-id或默认组织)
使用方法
agentuity cloud storage upload <name> <filename> [options]
参数
| 参数 | 类型 | 必填 | 描述 |
|---|---|---|---|
<name> |
字符串 | 是 | - |
<filename> |
字符串 | 是 | - |
选项
| 选项 | 类型 | 必填 | 默认值 | 描述 |
|---|---|---|---|---|
--key |
字符串 | 是 | - | 远程对象键(默认为文件名,管道上传时默认为"stdin") |
--contentType |
字符串 | 是 | - | 内容类型(未提供时自动检测) |
示例
上传文件到存储桶:
bunx @agentuity/cli cloud storage upload my-bucket file.txt
上传文件并指定内容类型:
bunx @agentuity/cli cloud storage put my-bucket file.txt --content-type text/plain
上传文件并指定自定义对象键:
bunx @agentuity/cli cloud storage upload my-bucket file.txt --key custom-name.txt
从标准输入上传:
cat file.txt | bunx @agentuity/cli cloud storage upload my-bucket -
从标准输入上传并指定自定义键:
cat data.json | bunx @agentuity/cli cloud storage upload my-bucket - --key data.json
输出
返回JSON对象:
{
"success": "boolean",
"bucket": "string",
"filename": "string",
"size": "number"
}
| 字段 | 类型 | 描述 |
|---|---|---|
success |
布尔值 | 上传是否成功 |
bucket |
字符串 | 存储桶名称 |
filename |
字符串 | 上传的文件名 |
size |
数字 | 文件大小(字节) |