Refactor mime type detection by using path/filepath package