read/bytes
This commit is contained in:
parent
5e3c8e93ff
commit
065d647e51
1 changed files with 4 additions and 3 deletions
|
@ -52,8 +52,9 @@ def make_directory(path: str) -> None:
|
||||||
Path(path).mkdir(exist_ok=True, parents=True)
|
Path(path).mkdir(exist_ok=True, parents=True)
|
||||||
|
|
||||||
|
|
||||||
def read_file(file_path: str):
|
def read_file_bytes(file_path: str) -> bytes:
|
||||||
with open(file_path, "br") as file_object:
|
"""Read whole file bytes."""
|
||||||
|
with Path(file_path).open("br") as file_object:
|
||||||
return file_object.read()
|
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):
|
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:
|
def wipe(path: str) -> None:
|
||||||
|
|
Loading…
Reference in a new issue