archiveFormatFromPath function

ArchiveFormat? archiveFormatFromPath(
  1. String filePath
)

Infers the archive format from a filesystem path's extension (omp's archiveFormatFromPath).

Implementation

ArchiveFormat? archiveFormatFromPath(String filePath) {
  final normalized = filePath.toLowerCase();
  if (normalized.endsWith('.tar.gz') || normalized.endsWith('.tgz')) {
    return ArchiveFormat.tarGz;
  }
  if (normalized.endsWith('.tar')) return ArchiveFormat.tar;
  if (normalized.endsWith('.zip')) return ArchiveFormat.zip;
  return null;
}