(chore) Add memory efficient method of getting mime type from a buffer and replace all calls to finfo - #1120