Skip to content
Back to skills

Aliyun Oss

ASecurity

阿里云 OSS 对象存储技能。支持文件上传、下载、列出、删除、获取 URL 等操作。\n 两层架构:Node.js SDK(优先)→ ossutil CLI。

  • 33 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added May 30, 2026
toolsbashnodeapi

Works with

  • cli
  • api

Security analysis

A92/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro scans all 7 files and shows the line behind each finding

Scanned May 30, 2026

npx -y skills add dvcrn/openclaw-skills-marketplace --skill aliyun-oss --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Aliyun Oss?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Aliyun Oss
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/dvcrn-aliyun-oss/badge)](https://www.skillsdirectory.com/skills/dvcrn-aliyun-oss)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: aliyun-oss
description: "阿里云 OSS 对象存储技能。支持文件上传、下载、列出、删除、获取 URL 等操作。\n 两层架构:Node.js SDK(优先)→ ossutil CLI。"
---

# ☁️ 阿里云 OSS 技能

通过 **Node.js SDK** / **ossutil CLI** 管理阿里云对象存储。

---

## 🎯 执行策略(两层降级)

| 优先级 | 工具 | 使用场景 |
|--------|------|----------|
| **1** | Node.js SDK (`ali-oss`) | 优先使用 |
| **2** | ossutil CLI | 备选 |

---

## 🚀 快速开始

### 1. 安装依赖

```bash
# 进入技能目录
cd ~/.openclaw/workspace/skills/aliyun-oss-skill

# 运行自动安装
bash scripts/setup.sh
```

### 2. 配置凭证

```bash
bash scripts/setup.sh \
  --access-key-id "YOUR_ACCESS_KEY_ID" \
  --access-key-secret "YOUR_ACCESS_KEY_SECRET" \
  --region "oss-cn-hangzhou" \
  --bucket "mybucket"
```

### 3. 测试连接

```bash
node scripts/oss_node.mjs test-connection
```

---

## 📋 使用示例

### 上传文件

```bash
node scripts/oss_node.mjs upload \
  --local "/path/to/file.txt" \
  --key "uploads/file.txt"
```

### 列出文件

```bash
node scripts/oss_node.mjs list --prefix "uploads/" --limit 100
```

### 下载文件

```bash
node scripts/oss_node.mjs download \
  --key "uploads/file.txt" \
  --local "/path/to/save.txt"
```

### 删除文件

```bash
node scripts/oss_node.mjs delete --key "uploads/file.txt" --force
```

### 获取文件 URL

```bash
# 公开空间
node scripts/oss_node.mjs url --key "uploads/file.txt"

# 私有空间(1小时有效)
node scripts/oss_node.mjs url --key "uploads/file.txt" --private --expires 3600
```

---

## 🔧 Node.js SDK API

| 命令 | 说明 |
|------|------|
| `upload --local <path> --key <key>` | 上传文件 |
| `download --key <key> --local <path>` | 下载文件 |
| `list [--prefix <p>] [--limit <n>]` | 列出文件 |
| `delete --key <key> [--force]` | 删除文件 |
| `url --key <key> [--private] [--expires <s>]` | 获取 URL |
| `stat --key <key>` | 文件信息 |
| `move --src-key <a> --dest-key <b>` | 移动文件 |
| `copy --src-key <a> --dest-key <b>` | 复制文件 |
| `test-connection` | 测试连接 |

---

## ⚙️ 配置文件

**config/oss-config.json**

```json
{
  "accessKeyId": "YOUR_ACCESS_KEY_ID",
  "accessKeySecret": "YOUR_ACCESS_KEY_SECRET",
  "bucket": "mybucket",
  "region": "oss-cn-hangzhou",
  "domain": "https://cdn.example.com"
}
```

**常用区域**:
- `oss-cn-hangzhou` - 华东1(杭州)
- `oss-cn-shanghai` - 华东2(上海)
- `oss-cn-beijing` - 华北2(北京)
- `oss-cn-shenzhen` - 华南1(深圳)

---

## 🐛 故障排查

| 问题 | 解决 |
|------|------|
| `Cannot find module 'ali-oss'` | `npm install ali-oss` |
| `403 Forbidden` | 检查 AccessKey 权限 |
| `连接超时` | 检查区域代码和网络 |

---

## 📚 相关链接

- [阿里云 OSS Node.js SDK](https://help.aliyun.com/document_detail/32068.html)
- [ossutil 工具](https://help.aliyun.com/document_detail/120075.html)

---

## 📄 许可证

MIT License

Files in this skill

  • README.md1.1 KB
  • SKILL.md3 KB
  • config/oss-config.example.json340 B
  • docs/EXAMPLES.md5.3 KB
  • package.json438 B
  • scripts/oss_node.mjs10.7 KB
  • scripts/setup.sh8.1 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.