Skip to content

feat: implmeent concurrent download support with context handling - #21

Merged
everpcpc merged 1 commit into
everpcpc:mainfrom
Miuzarte:main
Nov 23, 2025
Merged

feat: implmeent concurrent download support with context handling#21
everpcpc merged 1 commit into
everpcpc:mainfrom
Miuzarte:main

Conversation

@Miuzarte

Copy link
Copy Markdown
Contributor

  • downloadImage() 现在接受 context.Context
  • SetThreads() 可配置并发下载的线程数
  • 实现 DownloadIllustIter() 和 DownloadIllustSync() 用于流式下载
  • 从 illust 获取 urls 的逻辑提取到了 illustGetUrls() 辅助函数
  • 重构 downloadBytes() 至 downloadImage() ,现在返回带有图像数据、页码和图像格式的Image结构体
  • 导出方法 Download() 和 DownloadBytes() 的签名没改

  • Add context.Context to downloadImage()
  • Configurable thread count for concurrent download via SetThreads()
  • Add DownloadIllustIter() and DownloadIllustAsync() for streaming downloads
  • Extract getting urls from illust logic into illustGetUrls() helper func
  • Refactor downloadBytes() to downloadImage() returning structured Image type contains img data, page num and image format
  • Maintain backward compatibility with existing Download() and DownloadBytes() methods

实现了隐式多线程下载,DownloadIllustIter() 取得的数据仍是按顺序的
@everpcpc 先review?哪里有问题我后面再改改,有点breaking

- Add context.Context to downloadImage()
- Configurable thread count for concurrent download via SetThreads()
- Add DownloadIllustIter() and DownloadIllustAsync() for streaming downloads
- Extract getting urls from illust logic into illustGetUrls() helper func
- Refactor downloadBytes() to downloadImage() returning structured Image type contains img data, page num and image format
- Maintain backward compatibility with existing Download() and DownloadBytes() methods
@Miuzarte
Miuzarte marked this pull request as ready for review November 22, 2025 18:32
@everpcpc
everpcpc merged commit 384426b into everpcpc:main Nov 23, 2025
1 check passed
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