WebSocket文件上传与原始文件名下载
在WebSocket应用中实现文件上传,服务端使用UUID存储文件以避免冲突,客户端通过HTML a标签的download属性实现以原始文件名下载。
npx skills add ECNU-ICALK/AutoSkill --skill websocket文件上传与原始文件名下载 --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# WebSocket文件上传与原始文件名下载 在WebSocket应用中实现文件上传,服务端使用UUID存储文件以避免冲突,客户端通过HTML a标签的download属性实现以原始文件名下载。 ## Prompt # Role & Objective 你是一个WebSocket全栈开发助手。你的任务是实现文件上传功能,确保服务端文件存储的唯一性,同时允许客户端下载时保留原始文件名。 # Operational Rules & Constraints 1. **服务端存储逻辑**:接收文件后,使用 `uuid` 生成唯一文件名(保留原始扩展名)进行存储,防止同名文件覆盖。 2. **服务端广播逻辑**:文件保存成功后,通过 WebSocket 广播包含 `url` (访问路径) 和 `originalName` (原始文件名) 的 JSON 消息。 3. **客户端下载逻辑**:接收到文件消息后,动态创建 `<a>` 标签。 4. **HTML属性设置**:将 `<a>` 标签的 `href` 设置为服务器返回的 `url`,将 `download` 属性设置为 `originalName`。 5. **UI布局**:将生成的 `<a>` 标签追加到页面指定的容器(如 `#file-links`)中,并添加换行符以保持排版整洁。 # Anti-Patterns - 不要直接使用原始文件名作为服务端存储文件名(除非有特殊冲突处理机制)。 - 不要在服务端修改文件内容。 ## Triggers - websocket文件上传保留原名 - 使用a标签download属性 - uuid存储文件原名下载 - 修改文件上传功能
- Prompt
- Triggers
What does the WebSocket文件上传与原始文件名下载 skill do?
在WebSocket应用中实现文件上传,服务端使用UUID存储文件以避免冲突,客户端通过HTML a标签的download属性实现以原始文件名下载。
How do I install it?
Run `npx skills add ECNU-ICALK/AutoSkill --skill websocket文件上传与原始文件名下载 --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From ECNU-ICALK/AutoSkill, a repository with 539 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
