Chuyển đến nội dung
Skillpedia
Kiểm thử101k · #1150

export-download-debugging

Skill này làm gì

Công cụ này giúp tìm ra lý do một tệp bạn cố tải xuống hoặc xuất ra không thành công. Nó kiểm tra xem tệp đã được tạo đúng chưa trước khi lưu, đặc biệt với hình ảnh.

Khi nào nên dùng

  • ✓Khi tải xuống hoặc xuất tệp có vẻ thành công nhưng tệp cuối cùng bị rỗng.
  • ✓Khi một tệp hình ảnh tải về không mở được hoặc bị hỏng.
  • ✓Khi gặp khó khăn với chức năng “Lưu thành” trong trình duyệt hoặc ứng dụng.

Liên kết skill

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

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/nexu-io/open-design/blob/main/skills/export-download-debugging/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Hình ảnh xuất ra của tôi chỉ có dung lượng 0 KB, bạn có thể giúp tôi sửa không?”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Trước hết công cụ kiểm tra xem dữ liệu tệp có được tạo đúng không. Nếu có, nó thử dùng một phương pháp đơn giản và đáng tin cậy hơn để lưu tệp, tránh các lỗi thường tạo ra tệp rỗng.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

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.
Câu hỏi thường gặp

Tại sao tệp cuối cùng lại rỗng?

Điều này thường xảy ra khi hệ thống đã tạo tệp trên máy tính của bạn, nhưng việc ghi dữ liệu thực sự bị lỗi hoặc bị chặn trước khi hoàn thành.

“Payload” là gì?

Payload là thông tin hay dữ liệu bạn đang cố xuất hoặc tải xuống, như điểm ảnh của hình ảnh hoặc nội dung của tài liệu.

“Blob/Data URLs” là gì?

Đây là các cách biểu diễn dữ liệu (như hình ảnh) trực tiếp trong trình duyệt mà không cần tệp riêng. Công cụ kiểm tra xem chúng có hoạt động đúng không.

Chi tiết

Mô tả gốc của tác giả

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

Độ phổ biến

Sao GitHub
101k
Vị trí xếp hạng
#1150
Giấy phép
Apache-2.0
Cập nhật
15/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự