Skip to content

FileHandler

QuantConnect.Lean.Engine.Storage.FileHandler

Bases: Object

Raw file handler

create_directory

create_directory(path: str) -> DirectoryInfo

Create the requested directory path

delete

delete(path: str) -> None

Will delete the given file path

directory_exists

directory_exists(path: str) -> bool

True if the given directory exists

enumerate_files

enumerate_files(
    path: str,
    pattern: str,
    search_option: SearchOption,
    rootfolder: Optional[str],
) -> Tuple[Iterable[FileInfo], str]

Enumerate the files in the target path

exists

exists(path: str) -> bool

True if the given file path exists

read_all_bytes

read_all_bytes(path: str) -> List[int]

Read all bytes in the given file path

try_get_file_length

try_get_file_length(path: str) -> int

Will try to fetch the given file length, will return 0 if it doesn't exist

write_all_bytes

write_all_bytes(path: str, data: List[int]) -> None

Will write the given byte array at the target file path