Skip to main content

IsFileReadable

Checks if the given filepath is a valid and existing file path. If ignoreExtension is true, then the dir + basepath is checked for existence ignoring the extension. In the return the first return value is the actual path that exists (with the extension), second argument is the file info and finally the error

def IsFileReadable(
fpath: string,
ignoreExtension: bool
) - > string, os.FileInfo, error

Checks if the given filepath is a valid and existing file path. If ignoreExtension is true, then the dir + basepath is checked for existence ignoring the extension.

Parameters

NameTypeDescription
fpathstringThe file path to check for readability and existence.
ignoreExtensionboolA boolean indicating whether to ignore the file extension when checking for existence. If true, the function will look for any file matching the base path regardless of its extension.

Returns

TypeDescription
string, os.FileInfo, errorThe actual path that exists (with the extension), the file information, and an error if the file is not found or unreadable.