Corion has asked for the wisdom of the Perl Monks concerning the following question:
Again, I turn to you in search of a name:
Fed up with the existing solutions to determining the MIME type of a file using the magic numbers, I wrote a module to parse the XML database that is distributed by the freedesktop.org initiative at https://www.freedesktop.org/wiki/Software/shared-mime-info/.
This module allows an application to use its own rules for file type recognition independent of what other rules the operating system may have installed. Also, you gain independence of needing tools like autoconf being available for your platform.
The "problem" I have is coming up with a good name for this module. In the same problem space, there already are:
Currently, my file is not API-compatible with either of them (yet), so I'm not feeling exactly like using one of the above namespaces.
My current bad candidates are:
While it's always fun to write my own modules, if you know of other fairly general file type modules, feel free to also mention them here. There are some type-specific modules for audio and image files, which may be enough, depending on your application.
Update: The current API is the following:
my $mime = File::MimeInfo::SharedMimeInfoXML->new(); for my $file (@ARGV) { print sprintf "%s: %s\n", $file, $_->mime_type for $mime->mimetypes($file); };
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Looking for a name (Magic number MIME information on file from freedesktop.org database)
by Perlbotics (Archbishop) on Sep 17, 2016 at 15:18 UTC | |
by Corion (Patriarch) on Sep 17, 2016 at 21:06 UTC | |
Re: Looking for a name (Magic number MIME information on file from freedesktop.org database)
by RichardK (Parson) on Sep 17, 2016 at 13:54 UTC | |
Re: Looking for a name (Magic number MIME information on file from freedesktop.org database)
by ww (Archbishop) on Sep 17, 2016 at 12:33 UTC |