fromPath static method

ArchiveType? fromPath(
  1. String path
)

Detect archive type from URL path

Implementation

static ArchiveType? fromPath(String path) {
  final lowered = path.toLowerCase();
  if (lowered.endsWith('.tar.bz2') || lowered.endsWith('.tbz2')) {
    return ArchiveType.tarBz2;
  } else if (lowered.endsWith('.tar.gz') || lowered.endsWith('.tgz')) {
    return ArchiveType.tarGz;
  } else if (lowered.endsWith('.tar.xz') || lowered.endsWith('.txz')) {
    return ArchiveType.tarXz;
  } else if (lowered.endsWith('.zip')) {
    return ArchiveType.zip;
  }
  return null;
}