I'm creating a ruby script which goes through several zip files and validates the content of any xml files within. To optimise my script, I'm using the ruby-zip gem to open the zip files without extracting them.
My initial thought was to use filemagic to determine the MIME-type of the files, but the filemagic gem takes a file path and all I have are these Entry and InputStream classes which are unique to ruby-zip.
Is there a good way to determine the filetype without extracting? Ultimately I need to identify xml files, but I can get away with identifying plain-text files and using a regex to look for the