Skip to main content

Module files

Module files 

Source
Expand description

File utilities for CoderLib

Functions§

create_backup
Create a backup of a file
find_files_by_pattern
Find files matching a pattern in a directory
get_file_extension
Get file extension in lowercase
get_file_size
Get the size of a file in bytes
get_mime_type
Get the MIME type of a file based on its extension
get_relative_path
Get the relative path from one path to another
get_temp_file_path
Get a temporary file path with the given extension
has_allowed_extension
Check if a file has one of the allowed extensions
is_accessible_directory
Check if a directory exists and is accessible
is_readable_file
Check if a file exists and is readable
is_safe_path
Check if a path is safe (doesn’t contain dangerous patterns)
is_text_file
Check if a file is a text file based on its extension
is_within_size_limit
Check if a file is within size limits
normalize_path
Normalize a path by resolving . and .. components