fileExtension property

String fileExtension

Returns the common file extension for the MIME-Type.

Implementation

String get fileExtension {
  switch (subType) {
    case 'javascript':
      return 'js';
    case 'gzip':
      return 'gz';
    case 'svg+xml':
      return 'svg';
    case 'xhtml+xml':
      return 'xhtml';
    case 'mpeg':
      return type == 'audio' ? 'mp3' : 'mp3g';
    case 'x-icon':
      return 'ico';
    default:
      return subType;
  }
}