From 1353fa9b0d6eab975322325a18fd823eca166aaa Mon Sep 17 00:00:00 2001 From: pawank925 <229111348+pawank925@users.noreply.github.com> Date: Wed, 14 Oct 2026 11:10:44 +0530 Subject: [PATCH] Make save_large_file resumable with progress-based retries --- CHANGELOG.md | 2 + src/zimscraperlib/download.py | 173 ++++++++++++++++++---- tests/download/test_download.py | 252 +++++++++++++++++++++++++++++++- 3 files changed, 393 insertions(+), 34 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 41ff6fb..4e9e06b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,9 +12,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Index ePub documents for full-text search, with a new `get_epub_index_data` helper and automatic indexing of ePub items, like PDFs already are (#333) - Send a Wikimedia-compliant default `User-Agent` in `stream_file` when downloading from `upload.wikimedia.org` (#214) - Add fuzzy rule to rewrite URLs of lesbases.anct.gouv.fr (#334) +- Report progress from `save_large_file` through a new `on_progress` callback and periodic logging, and stream the download to a `.part` file that is only moved into place once complete (#348) ### Fixed +- Rewrite `save_large_file` to stream and resume the download itself instead of running `wget` once, whose `-t` counter is a budget for the whole download: a flaky connection now keeps resuming and the retry budget only counts attempts that make no progress, so long downloads are no longer abandoned mid-way (#348) - Carry a script's top-level `const`, `let` and `class` declarations across the wombat block, so other scripts on the page can still see them (#329) - Keep a rewritten `