跳到正文
Skillpedia
测试101k · #1150

export-download-debugging

它能做什么

这个工具可以帮你找出下载或导出文件失败的原因。它会在保存文件之前,先检查文件是否被正确生成,尤其是图片文件。

适用场景

  • ✓当下载或导出看似成功,但文件最后是空的时。
  • ✓当下载的图片无法打开或已经损坏时。
  • ✓当你在浏览器或应用中使用“另存为”功能遇到问题时。

技能链接

https://github.com/nexu-io/open-design/blob/main/skills/export-download-debugging/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/nexu-io/open-design/blob/main/skills/export-download-debugging/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“我导出的图片只有 0 KB,能帮我修复吗?”

每周 5 个新技能,1 分钟读完。

工作原理

它会先检查文件的数据是否正确生成。如果数据没有问题,就会改用更简单、更可靠的方法来保存文件,避开容易导致空文件的常见问题。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Export Download Debugging

Use this when an export or download appears to run but produces an empty, missing, or unusable file. It is tuned for browser previews, iframe capture, and Electron shells.

Core rule

Separate capture from save. Prove the export payload has non-zero bytes before debugging the destination path. A 0 KB file often means the native picker or host created the target file, then the write failed or was blocked.

Evidence

  • Record the payload type, MIME type, byte length, object URL or data URL path, and thrown error name/message.
  • Check browser console output and app logs around showSaveFilePicker, createWritable, <a download>, URL.createObjectURL, and URL revocation.
  • In Electron, inspect the will-download path: filename, MIME, file extension, save dialog filters, cancellation, and final file size.
  • Confirm the actual downloaded file size on disk and whether it opens in a normal image viewer.

Fix order

  1. Prepare and validate the export payload first; disable Save until bytes are available.
  2. Prefer the simplest stable save channel for the host. If showSaveFilePicker().createWritable() fails, is sandboxed, or creates empty files, route to <a download> or Electron's download manager instead.
  3. Avoid opening a native picker before the payload is ready. This prevents the host from creating an empty destination file on later write failure.
  4. For PNG fallback, prefer a verified non-empty data URL when blob URLs, revocation timing, CSP, or iframe sandboxing are suspicious.
  5. In Electron, add explicit Save As filters for exported image extensions (.png, .jpg, .jpeg, .webp) so users can choose a real image target.
  6. Keep the UI restrained: format selection, filename/path hint, clear pending and error states, and one primary save action.

Validation

  • Add or update tests for non-empty payload preparation, fallback save behavior, file extension/MIME mapping, and UI disabled/error states.
  • Run focused export tests, then pnpm --filter @open-design/web typecheck.
  • If Electron download handling changed, also run pnpm --filter @open-design/desktop typecheck.
  • Before landing, run pnpm guard, inspect the staged diff for unrelated files, generated artifacts, and accidental secrets, then use the repository's PR quality-gate workflow if the fix is being prepared for review.
常见问题

为什么文件会变成空的?

这通常是因为系统已经在你的电脑上创建了文件,但在写入实际数据的过程中失败,或者在完成前被阻止了。

什么是 payload(载荷)?

payload 指你想导出或下载的信息和数据,比如图片的像素或文档的内容。

什么是 Blob/Data URLs?

这是在浏览器中直接表示数据(如图片)的方式,无需单独的文件。工具会检查它们是否正常工作。

详情

作者的原始描述

Diagnose and fix browser, preview, or Electron export/download failures, especially image export issues involving Save As, Blob/Data URLs, the File System Access API, createWritable failures, and 0 KB files.

repo: nexu-io/open-design

热度

GitHub 星标
101k
排名
#1150
许可证
Apache-2.0
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能