aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/wikiget/dl.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/wikiget/dl.py b/src/wikiget/dl.py
index 898e6ab..49b44ea 100644
--- a/src/wikiget/dl.py
+++ b/src/wikiget/dl.py
@@ -162,12 +162,11 @@ def download(f: File, args: Namespace) -> int:
unit="B",
unit_scale=True,
unit_divisor=wikiget.CHUNKSIZE,
- ) as progress_bar:
- with fd:
- res = site.connection.get(file_url, stream=True)
- for chunk in res.iter_content(wikiget.CHUNKSIZE):
- fd.write(chunk)
- progress_bar.update(len(chunk))
+ ) as progress_bar, fd:
+ res = site.connection.get(file_url, stream=True)
+ for chunk in res.iter_content(wikiget.CHUNKSIZE):
+ fd.write(chunk)
+ progress_bar.update(len(chunk))
# verify file integrity and log details
try: