Skip to content

Instantly share code, notes, and snippets.

@omerfarukz
Last active April 24, 2017 14:39
Show Gist options
  • Save omerfarukz/81e9a16d35aa3baf1eb4d6c48825a701 to your computer and use it in GitHub Desktop.
Save omerfarukz/81e9a16d35aa3baf1eb4d6c48825a701 to your computer and use it in GitHub Desktop.
$response = (curl "http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types")
$headerPassed = $False
ForEach ($line in $($response.Content -split '[\r\n]')) {
if ($headerPassed -eq $False) {
$headerPassed = $line.StartsWith("# =")
continue
}
else
{
$mime = $null;
$extensions = $null;
if($line.StartsWith("#")) {
$mime = $line.Substring(2)
}
else
{
$m, $e = ($line -split '\t')
$mime = $m | ? {$_}
$extensions = $e | ? {$_}
}
"MIME: $mime E: $extensions"
ForEach ($e in $extensions -split ' ' | ? {$_}) {
$e
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment