in components/processing/libs/processor-base/src/processors/base/gcsio.py [0:0]
def crc32c(self) -> str:
"""Get the crc32c of the file or object"""
if self.preset_crc32c:
return self.preset_crc32c
if self.bucket:
obj = self.bucket.blob(self.path)
obj.reload()
return obj.crc32c
# Calculate from local filesystem
from google_crc32c import Checksum # pylint: disable=import-outside-toplevel
crc32c = Checksum()
size = 4096
with open(self.path, "rb") as f:
while True:
b = f.read(size)
if not b:
break
crc32c.update(b)
return str(base64.urlsafe_b64encode(crc32c.digest()), "utf8")