getExtensionByMime

getExtensionByMime ( string pathFileOnDisk , bool[default:false] isMimeString ) : string

Get the file extension analyzing its mime type.

Parameters

pathFileOnDisk

Path of the file

isMimeString

If true, the first parameter is not considered as a file path, but as a mime string (ex: "image/gif"), and this function will return the extension corresponding to this type. Else the first paramter must be a file path.

Example


console(getExtensionByMime(path("desktop")+"myPDF.pdf")) //->"pdf"
console(getExtensionByMime("application/zip", true) //->"zip"