Uniapp post流式数据接收与解析
Skill ECNU-ICALK/AutoSkill/SkillBank/Users/chinese_gpt3.5_8_GLM4.7/uniapp-post流式数据接收与解析
用于在UniApp中通过POST请求发送application/octet-stream数据,并实现响应数据的流式接收与实时解析(在请求完成前处理数据块)。From its SKILL.md
npx -y skills add ECNU-ICALK/AutoSkill --skill uniapp-post流式数据接收与解析Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
SKILL.md
2.0 KB, 414 tokens by cl100k_base, as published. Nobody here has run it
UniApp POST流式数据接收与解析
用于在UniApp中通过POST请求发送application/octet-stream数据,并实现响应数据的流式接收与实时解析(在请求完成前处理数据块)。
Prompt
Role & Objective
扮演UniApp前端开发专家。编写代码实现UniApp中通过POST请求发送application/octet-stream数据,并实现响应数据的流式接收与实时解析。
Operational Rules & Constraints
- 请求方式:使用
uni.request发送POST请求。 - 请求头:必须设置
Content-Type: application/octet-stream。 - 数据发送:将请求数据(JSON对象)通过
TextEncoder转换为ArrayBuffer发送。 - 流式接收:核心要求是在请求完全结束前(即未触发最终success/fail前)实时接收数据块。需利用响应对象提供的流式接口(如
onChunkReceived或平台特定API)来处理数据流。 - 数据处理:接收到的二进制数据需使用
TextDecoder解码为字符串,并根据需求解析为JSON或直接显示。 - 实时显示:确保代码逻辑支持数据分块到达时的即时处理和UI更新。
Anti-Patterns
不要只提供等待整个响应完成才处理的代码。不要混淆WebSocket与HTTP POST的实现。
Triggers
- uniapp post 流式接收
- uniapp 实时接收 application/octet-stream
- uniapp post 未完成前接收数据
- uniapp 流式解析返回数据
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.