public getMimeFromPath()

in DevSkim-VSCode-Plugin/server/src/utility_classes/pathOperations.ts [70:337]


    public getMimeFromPath(filePath : string) : string
    {
        let path = require('path');

        let extension : string = path.extname(filePath);
        switch (extension.toLowerCase())
        {
            case ".bat":
            case ".cmd": return "text/x-c";

            case ".clj":
            case ".cljs":
            case ".cljc":
            case ".cljx":
            case ".clojure":
            case "edn": return "text/plain";

            case ".coffee":
            case ".cson": return "text/plain";

            case ".c": return "text/x-c";

            case ".cpp":
            case ".cc":
            case ".cxx":
            case ".c++":
            case ".h": 
            case ".hh":
            case ".hxx":
            case ".hpp":
            case ".h++": return "text/x-c";

            case ".cs":
            case ".csx":
            case ".cake": return "text/plain";

            case ".css": return "text/css";

            case ".dockerfile": return "text/plain";

            case ".fs":
            case ".fsi":
            case ".fsx":
            case ".fsscript": return "text/plain";

            case ".go": return "text/plain";

            case ".groovy": 
            case ".gvy": 
            case ".gradle": return "text/plain";

            case ".handlebars":
            case ".hbs": return "text/plain";

            case ".hlsl":
            case ".fx":
            case ".fxh":
            case ".vsh":
            case ".psh":
            case ".cfinc":
            case ".hlsli": return "text/plain";

            case ".html":
            case ".htm":
            case ".shtml":
            case ".xhtml":
            case ".mdoc":
            case ".jsp":
            case ".asp":
            case ".aspx":
            case ".jshtm":
            case ".volt":
            case ".ejs":
            case ".rhtml": return "text/html";

            case ".ini": return "text/plain";

            case ".jade": 
            case ".pug": return "jade";

            case ".java": 
            case ".jav": return "text/plain";

            case ".jsx": return "text/javascript";

            case ".js":
            case ".es6":
            case "mjs":
            case ".pac": return "text/javascript";

            case ".json":
            case ".bowerrc":
            case ".jshintrc":
            case ".jscsrc":
            case ".eslintrc":
            case ".babelrc":
            case ".webmanifest":
            case ".code-workspace": return "application/json";

            case ".less": return "text/plain";

            case ".lua": return "text/plain";

            case ".mk": return "text/plain";

            case ".md":
            case ".mdown":
            case ".markdown": 
            case "markdn": return "text/plain";

            case ".m":
            case ".mm": return "text/x-c";

            case ".php":
            case ".php3":
            case ".php4":
            case ".php5":
            case ".phtml":
            case ".ph3":
            case ".ph4": 
            case ".ctp": return "text/plain";

            case ".pl":
            case ".pm":
            case ".t":
            case "p6":
            case "pl6":
            case "pm6":
            case "nqp":
            case ".pod": return "text/x-script.perl";
            


            case ".ps1":
            case ".psm1": 
            case ".psd1":
            case ".pssc":
            case ".psrc": return "text/plain";

            case ".py":
            case ".rpy":
            case ".pyw":
            case ".cpy":
            case ".gyp":
            case ".gypi": return "text/x-script.python";

            case ".r":
            case ".rhistory":
            case ".rprofile":
            case ".rt": return "text/plain";

            case ".cshtml": return "text/html";

            case ".rb":
            case ".rbx":
            case ".rjs":
            case ".gemspec":
            case ".rake":
            case ".ru":
            case ".erb":  return "text/plain";

            case ".rs": return "text/plain";

            case ".scala":
            case ".sc": return "text/plain";

            case ".scss": return "text/plain";

            case ".shadder": return "text/plain";

            case ".sh": 
            case ".bash": 
            case ".bashrc": 
            case ".bash_aliases": 
            case ".bash_profile": 
            case ".bash_login": 
            case ".ebuild": 
            case ".install": 
            case ".profile": 
            case ".bash_logout": 
            case ".zsh": 
            case ".zshrc": 
            case ".zprofile": 
            case ".zlogin": 
            case ".zlogout": 
            case ".zshenv": 
            case ".zsh-theme": return "text/plain";

            case ".sql":
            case ".dsql": return "text/plain";  

            case ".swift": return "text/plain";

            case ".ts": return "text/plain";  

            case ".tsx": return "text/plain";     

            case ".vb":
            case ".vba":
            case "brs":
            case ".bas":  
            case ".vbs": return "text/plain";

            case ".xml":
            case ".xsd":
            case ".ascx":
            case ".atom":
            case ".axml":
            case ".bpmn":
            case ".config":
            case ".cpt":
            case ".csl":
            case ".csproj":
            case ".csproj.user":
            case  ".dita":
            case ".ditamap":
            case ".dtd":
            case ".dtml":
            case ".fsproj":
            case ".fxml":
            case ".iml":
            case ".isml":
            case ".jmx":
            case ".launch":
            case ".menu":
            case ".mxml":
            case ".nuspec":
            case  ".opml":
            case ".owl":
            case ".proj":
            case ".props":
            case ".pt":
            case ".publishsettings":
            case ".pubxml":
            case ".pubxml.user":
            case ".rdf":
            case ".rng":
            case ".rss":
            case ".shproj":
            case ".storyboard":
            case ".svg":
            case ".targets":
            case ".tld":
            case ".tmx":
            case ".vbproj":
            case ".vbproj.user":
            case ".vcxproj":
            case ".vcxproj.filters":
            case ".wsdl":
            case ".wxi":
            case  ".wxl":
            case ".wxs":
            case ".xaml":
            case ".xbl":
            case ".xib":
            case ".xlf":
            case ".xliff":
            case ".xpdl":
            case ".xul":
            case ".xoml": return "text/xml";

            case ".yaml":
            case "eyaml":
            case "eyml":
            case ".yml": return "text/plain";
        }        
        return "text/plain";
    }