Update with chunks again

This commit is contained in:
niten 2023-01-10 11:01:27 -08:00
parent cdc033f541
commit 7ba41ca26c
1 changed files with 1 additions and 1 deletions

View File

@ -116,10 +116,10 @@ def analyze_image(request: Request, image: UploadFile):
base_url = re.sub(r'\/images\/?$', '/analyzed_images/', str(request.url))
infile = incoming_dir / image.filename
file_hash = hashlib.sha256()
file_hash.update(image)
with open(infile, "w") as f:
chunk = image.read(buffer_size)
while chunk:
file_hash.update(chunk)
print ("writing " + buffer_size + " bytes")
f.write(chunk)
chunk = image.read(buffer_size)