Algorithms documentation¶
Save files function¶
- main.algorithm.save_files(files, last_id: int)¶
Allocate new directory for the files and save them there.
- Parameters:
files (list of files) – file names
last_id (int) – index for filepath
- Returns:
Get converted file path¶
- main.algorithm.get_converted_file_path(index: int)¶
Function to get converted path via index. :param index: index of converted path directory :type index: int :return: converted path directory :rtype: str
Zip all files in directory function function¶
- main.algorithm.zip_files_in_dir(filepath: str, files, zip_file_name: str)¶
Zip all files in given directory.
- Parameters:
filepath (str) – path to input files
files (list of str) – file names
zip_file_name (str) – name of zip file
:return file_format :rtype string
Form a file response function¶
- main.algorithm.get_file_response(file_path: str, file_name: str)¶
Form the file response for files in given directory and return it.
- Parameters:
file_path (str) – path to input files
file_name (str) – name of file
- Returns:
response object
- Return type:
django.http.response.HttpResponse
Convert files core function¶
- main.algorithm.convert(filepath: str, files: List[str], index, has_type_in_request: Dict[str, bool])¶
Conversion operator that determines the OS, calls suitable conversion algorithm, and returns path to them.
- Parameters:
has_type_in_request (Dict[str, bool]) – flag of each type in request
filepath (str) – path to input files
files (list of str) – file names
index (int) – index for filepath
- Returns:
path to converted files
- Return type:
str