More visibility into attached files and duplicate status (#776)

This commit is contained in:
Kerem Yilmaz 2024-09-06 11:08:33 +03:00 committed by GitHub
parent 73227963dd
commit be1c8ba060
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 33 additions and 1 deletions

View file

@ -1,3 +1,4 @@
import hashlib
import os
import tempfile
import zipfile
@ -86,3 +87,12 @@ def get_number_of_files_in_directory(directory: Path, recursive: bool = False) -
break
count += len(files)
return count
def calculate_sha256(file_path: str) -> str:
"""Helper function to calculate SHA256 hash of a file."""
sha256_hash = hashlib.sha256()
with open(file_path, "rb") as f:
for byte_block in iter(lambda: f.read(4096), b""):
sha256_hash.update(byte_block)
return sha256_hash.hexdigest()