showing download progress in "MiB"
This commit is contained in:
parent
6dab2f989b
commit
1c6815ae74
@ -38,7 +38,7 @@ def _download(url: str, root: str = os.path.expanduser("~/.cache/clip")):
|
|||||||
warnings.warn(f"{download_target} exists, but the SHA256 checksum does not match; re-downloading the file")
|
warnings.warn(f"{download_target} exists, but the SHA256 checksum does not match; re-downloading the file")
|
||||||
|
|
||||||
with urllib.request.urlopen(url) as source, open(download_target, "wb") as output:
|
with urllib.request.urlopen(url) as source, open(download_target, "wb") as output:
|
||||||
with tqdm(total=int(source.info().get("Content-Length")), ncols=80) as loop:
|
with tqdm(total=int(source.info().get("Content-Length")), ncols=80, unit='iB', unit_scale=True) as loop:
|
||||||
while True:
|
while True:
|
||||||
buffer = source.read(8192)
|
buffer = source.read(8192)
|
||||||
if not buffer:
|
if not buffer:
|
||||||
|
Loading…
Reference in New Issue
Block a user