Skip to content

Commit

Permalink
fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
b4rtaz committed Jul 31, 2024
1 parent 945df03 commit 4938276
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,18 @@ def downloadFile(urls: str, path: str):
if (result.upper() != 'Y'):
return

lastSize = 0
lastSizeMb = 0
with open(path, 'wb') as file:
for url in urls:
print(f'📄 {url}')
response = requests.get(url, stream=True)
response.raise_for_status()
for chunk in response.iter_content(chunk_size=4096):
file.write(chunk)
size = file.tell() // (1024 * 1024)
if (size - lastSize >= 8192):
sys.stdout.write("\rDownloaded %i MB" % size)
lastSize = size
sizeMb = file.tell() // (1024 * 1024)
if (sizeMb != lastSizeMb):
sys.stdout.write("\rDownloaded %i MB" % sizeMb)
lastSizeMb = sizeMb
sys.stdout.write('\n')
sys.stdout.write(' ✅\n')

Expand Down

0 comments on commit 4938276

Please sign in to comment.