flask_file_share.utils package
Initialization module for utility functions.
Submodules
File: mimetype.py
A utility module for handling file-related operations.
- flask_file_share.utils.mimetype.get_file_content_type(file_path: str) → str | None
Get the content type based on the file extension using the mimetypes library.
- Parameters:
file_path (str) – Path to the file.
- Returns:
Content type of the file.
- Return type:
Union[str, None]
File: slugify.py
A utility module for slugifying filenames.
- flask_file_share.utils.slugify.slugify_filename(filename: str | Path) → str
- flask_file_share.utils.slugify.slugify_filepath(filename: str | Path) → Path
Slugify the filename.
- Parameters:
filename (str) – The original filename.
- Returns:
The slugified filename.
- Return type:
str
File: zip.py
A utility module for creating ZIP archives.
- flask_file_share.utils.zip.create_zip_archive(filepaths: List[str], output_fname: str) → Tuple[str, bytes]
Create a ZIP archive containing specified files.
- Parameters:
filepaths (list of str) – List of files to be included in the ZIP archive.
output_fname (str) – Name of the ZIP archive.
- Returns:
A tuple containing the filename of the ZIP archive and its content as bytes.
- Return type:
tuple