feat(download): 合集批量下载支持分包、断点续传与失败重试 - #190
Open
wangshucheng wants to merge 1 commit into
Open
wangshucheng wants to merge 1 commit into
wangshucheng wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景 / 问题
大合集在一次批量下载时,会把全部文章资源塞进单个 zip,再调用
JSZip.generateAsync生成。资源(尤其是图片/视频较多)体量过大时,单次打包的内存峰值过高,极易触发Array buffer allocation failed,导致整批下载失败,且失败前已下载内容无法复用、只能重头再来。主要变更
1. 分包下载(
composables/useBatchDownload.ts)Array buffer allocation failed。partXX-ofYY.zip),便于排序与解压。2. 断点续传
localStorage(key 按taskId,建议传fakeid + album_id区分合集),再次触发下载时跳过已完成分包。checkResumable()同时校验文章总数与分包大小:若调整后分包划分变化,旧进度不再误判为可续传。3. 失败重试
4. 进度反馈 UI(
pages/dashboard/album.vue)UProgress百分比)+ 失败分包红色高亮提示;切换合集时自动检测续传进度。5. 分包大小可配置(
composables/useDownloadSettings.ts)变更文件
composables/useBatchDownload.ts(+328/-26):核心下载逻辑重写为分包 + 续传 + 重试。composables/useDownloadSettings.ts(新增):分包大小设置与持久化。pages/dashboard/album.vue(+88):进度反馈 UI 与分包大小配置控件。测试建议
partXX-ofYY.zip。Array buffer allocation failed。