File type identification using libmagic