read/bytes

This commit is contained in:
Marc Beninca 2024-09-13 18:55:31 +02:00
parent 5e3c8e93ff
commit 065d647e51
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

View file

@ -52,8 +52,9 @@ def make_directory(path: str) -> None:
Path(path).mkdir(exist_ok=True, parents=True)
def read_file(file_path: str):
with open(file_path, "br") as file_object:
def read_file_bytes(file_path: str) -> bytes:
"""Read whole file bytes."""
with Path(file_path).open("br") as file_object:
return file_object.read()
@ -62,7 +63,7 @@ def read_file_lines(file_path: str, charset: str = CHARSET):
def read_file_text(file_path: str, charset: str = CHARSET):
return read_file(file_path).decode(charset)
return read_file_bytes(file_path).decode(charset)
def wipe(path: str) -> None: