FileHelper
Class containing only classmethod to simplify file management
Return the extension of a file without the '.' if it is present on first caracter
strstrCopy a directory from source to destination
UnionUnionCopy the content of a directory to another directory
UnionUnionCopy a file from source to destination
UnionUnionCopy a file or a directory from source to destination
UnionUnionCreate a directory and all intermediate directories if they do not exist
UnionPathCreate an empty file if it does not exist. Creates intermediate directories if needed.
UnionPathCreate a FastAPI FileResponse from a file path
UnionstrstrLiteral - attachmentFileResponseDelete a directory and all its content
Unionbool - TrueDelete all the content of a directory but not the directory itself.
Unionbool - TrueDelete a file
Unionbool - TrueDelete a file or a directory
Unionbool - TrueDetect the encoding of a file using charset-normalizer.
Unionstr - utf-8strExist on local machine
UnionReturn the parent directory of a file or a folder
UnionPathReturn the content of a directory as a json nested object.
UnionAnyReturn 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.
UnionReturn the extension of a file without the '.'. Return None if no extension is found (like folder).
UnionstrReturn the extension of a file from its content type
strstrReturn a human readable size from a size in bytes. Ex : 1024 -> 1 KB
floatstrUnionstrReturn the name of the file without the extension or the name of the folder
UnionReturn the name of the file with the extension or the name of the folder
UnionReturn a Path object from a string or a Path object
UnionPathReturn the size of a file or a folder. For folder, it is the sum of the size of all files in the folder (recursive).
UnionintUnionboolUnionboolUnionboolUnionboolUnionboolUnionboolUnionboolUnionboolUnionboolUnionboolMove a file or a directory from source to destination
UnionUnionSanitize a file name, folder name or path in order to prevent injection when using the file name Removes dangerous characters and prevents path traversal attacks
strstrGenerate 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.
strstrstrGenerate 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.
Liststrstr