detectFormat function

FormatType detectFormat(
  1. String filename
)

Implementation

FormatType detectFormat(String filename) {
  final ext = _getExtension(filename);
  if (_officeExtensions.contains(ext)) {
    if (ext == 'docx') return FormatType.officeDocx;
    if (ext == 'pptx') return FormatType.officePptx;
    return FormatType.officeXlsx;
  }
  if (_nosExtensions.contains(ext)) return FormatType.nos;
  if (_plaintextExtensions.contains(ext)) return FormatType.plaintext;
  if (_dicomExtensions.contains(ext)) return FormatType.dicom;
  // Default to NOS for unknown binary formats
  return FormatType.nos;
}