Open
Description
Description
Mime type to file extension is already supported by FILEINFO_EXTENSION
but it is impossible to specify the mime type :).
I expect code like:
$mimetype = 'application/zip';
$finfo = finfo_open(FILEINFO_EXTENSION);
var_dump(finfo_buffer($finfo, $mimetype, FILEINFO_EXTENSION)); // notice $mimetype is mime type not file data
to dump zip
.
It should be possible to find the file magic data by iterating the magic data like in https://github.com/file/file/blob/FILE5_45/src/softmagic.c#L135, the mime/ext is defined in https://github.com/file/file/blob/FILE5_45/src/file.h#L371.