ClariDoc / app /utils /document_op.py
Kshitijk20's picture
code push
e5b884f
raw
history blame contribute delete
417 Bytes
import os
class DocumentOperation:
@staticmethod
def get_file_type_by_extension(filename):
_, extension = os.path.splitext(filename)
extension = extension.lower()
if extension == ".txt":
return "text"
elif extension == ".pdf":
return "pdf"
elif extension in [".doc", ".docx"]:
return "word"
else:
return "unknown"