use libmagic for mimetype guess