We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e69923c commit 17fd383Copy full SHA for 17fd383
mbed/mbed.py
@@ -389,10 +389,13 @@ def fetch_rev(url, rev):
389
try:
390
if not os.path.exists(rev_file):
391
action("Downloading library build \"%s\" (might take a while)" % rev)
392
- outfd = open(rev_file, 'wb')
393
inurl = urlopen(url)
394
- outfd.write(inurl.read())
395
- outfd.close()
+ with open(rev_file, 'wb') as outfd:
+ data = None
+ while data != '':
396
+ # Download and write the data in 1 MB chunks
397
+ data = inurl.read(1024 * 1024)
398
+ outfd.write(data)
399
except:
400
if os.path.isfile(rev_file):
401
os.remove(rev_file)
0 commit comments