mirror of
https://github.com/fuckpiracyshield/component.git
synced 2024-05-20 05:56:19 +02:00
29 lines
563 B
Python
29 lines
563 B
Python
import os
|
|
|
|
class Filesystem:
|
|
|
|
"""
|
|
Class to manage elements on the filesystem.
|
|
"""
|
|
|
|
def get_size(self, absolute_file_path) -> int | Exception:
|
|
"""
|
|
Returns the size in Bytes format.
|
|
|
|
:param file_path: the absolute path of the file.
|
|
"""
|
|
|
|
if os.path.exists(absolute_file_path):
|
|
return os.path.getsize(absolute_file_path)
|
|
|
|
else:
|
|
raise FilesystemNotFoundException()
|
|
|
|
class FilesystemNotFoundException(Exception):
|
|
|
|
"""
|
|
Element not found in the filesystem.
|
|
"""
|
|
|
|
pass
|