File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -313,8 +313,9 @@ def download(
313
313
tmp_file = None
314
314
f = output
315
315
316
- if tmp_file is not None and f .tell () != 0 :
317
- headers = {"Range" : "bytes={}-" .format (f .tell ())}
316
+ start_size = f .tell ()
317
+ if tmp_file is not None and start_size :
318
+ headers = {"Range" : "bytes={}-" .format (start_size )}
318
319
res = sess .get (url , headers = headers , stream = True , verify = verify )
319
320
320
321
if not quiet :
@@ -337,9 +338,9 @@ def download(
337
338
try :
338
339
total = res .headers .get ("Content-Length" )
339
340
if total is not None :
340
- total = int (total )
341
+ total = int (total ) + start_size
341
342
if not quiet :
342
- pbar = tqdm .tqdm (total = total , unit = "B" , unit_scale = True )
343
+ pbar = tqdm .tqdm (total = total , unit = "B" , initial = start_size , unit_scale = True )
343
344
t_start = time .time ()
344
345
for chunk in res .iter_content (chunk_size = CHUNK_SIZE ):
345
346
f .write (chunk )
You can’t perform that action at this time.
0 commit comments