Skip to content

fix(download): add error handling, backpressure, and flush-wait#44

Merged
RyanLee-Dev merged 1 commit intomainfrom
fix/download-stability
Apr 6, 2026
Merged

fix(download): add error handling, backpressure, and flush-wait#44
RyanLee-Dev merged 1 commit intomainfrom
fix/download-stability

Conversation

@EElaineYIN
Copy link
Copy Markdown

Summary

  • Error handling: Register writer.on('error') to catch disk-full/permission errors instead of crashing
  • Backpressure: Check writer.write() return value and await drain event to prevent unbounded memory growth
  • Flush wait: Await writer.on('finish') before returning to prevent truncated files
  • Cleanup: Delete partial files on download failure
  • Error type: Use CLIError instead of plain Error for structured output

Test plan

  • Normal download (speech/video) works correctly
  • File size matches expected bytes

🤖 Generated with Claude Code

- Register writer.on('error') to catch disk-full/permission errors
- Check writer.write() return value and await drain for backpressure
- Await writer finish event before returning to prevent truncated files
- Clean up partial files on failure
- Use CLIError instead of plain Error

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@RyanLee-Dev RyanLee-Dev merged commit 46f460f into main Apr 6, 2026
2 checks passed
@RyanLee-Dev RyanLee-Dev deleted the fix/download-stability branch April 8, 2026 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants