From 48f18e0c31def625511bf8887fbc3611c1168af4 Mon Sep 17 00:00:00 2001 From: Matteo Campinoti Date: Tue, 31 Oct 2023 13:35:14 +0100 Subject: [PATCH] models:file - add get_size method to get and update file size --- acacore/models/file.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/acacore/models/file.py b/acacore/models/file.py index 483ffb1..6363284 100644 --- a/acacore/models/file.py +++ b/acacore/models/file.py @@ -131,6 +131,10 @@ def get_checksum(self) -> str: self.checksum = file_checksum(self.get_absolute_path(self.root)) return self.checksum + def get_size(self) -> int: + self.size = self.get_absolute_path(self.root).stat().st_size + return self.size + @property def name(self) -> str: """