guess file extension by libmagic