Class containing only classmethod to simplify file management
Return the extension of a file without the '.' if it is present on first caracter
str
str
Copy a directory from source to destination
Union
Union
Copy the content of a directory to another directory
Union
Union
Copy a file from source to destination
Union
Union
Copy a file or a directory from source to destination
Union
Union
Create a directory and all intermediate directories if they do not exist
Union
Path
Create an empty file if it does not exist. Creates intermediate directories if needed.
Union
Path
Create a FastAPI FileResponse from a file path
Union
str
str
FileResponse
Delete a directory and all its content
Union
bool
- True
Delete all the content of a directory but not the directory itself.
Union
bool
- True
Delete a file
Union
bool
- True
Delete a file or a directory
Union
bool
- True
Detect the encoding of a file using charset-normalizer.
Union
str
- utf-8
str
Exist on local machine
Union
Return the parent directory of a file or a folder
Union
Path
Return the content of a directory as a json nested object.
Union
Any
Return the name of the folder. If the path is a file, return the name of the parent folder. If the path is a folder, return the name of the folder.
Union
Return the extension of a file without the '.'. Return None if no extension is found (like folder).
Union
str
Return the extension of a file from its content type
str
str
Return a human readable size from a size in bytes. Ex : 1024 -> 1 KB
float
str
Union
str
Return the name of the file without the extension or the name of the folder
Union
Return the name of the file with the extension or the name of the folder
Union
Return a Path object from a string or a Path object
Union
Path
Return the size of a file or a folder. For folder, it is the sum of the size of all files in the folder (recursive).
Union
int
Union
bool
Union
bool
Union
bool
Union
bool
Union
bool
Union
bool
Union
bool
Union
bool
Union
bool
Move a file or a directory from source to destination
Union
Union
Sanitize a file name, folder name or path in order to prevent injection when using the file name Basically, it keeps only the alphanumeric characters and -,_,,/
str
str
Generate a unique fs node name for a list of node names. Append _1, _2... before the extension if the str is already in the list. Useful to avoid name collision when adding a file to a directory.
str
str
str
Generate a unique fs node name for a list of node names. Append _1, _2... before the extension if the str is already in the list. Useful to avoid name collision when adding a file to a directory.
List
str
str