File-MimeInfo

 view release on metacpan or  search on metacpan

mimetype  view on Meta::CPAN


=item B<-l> I<code>, B<--language>=I<code>

The language attribute specifies a two letter language code, this makes
descriptions being outputted in the specified language.

=item B<-M>, B<--magic-only>

Do not check for extensions, globs or inode type, only look at the content
of the file. This is particularly useful if for some reason you don't trust
the name or the extension a file has.

=item B<-N>, B<--noalign>

Do not align output fields.

=item B<--output-format>

If you want an alternative output format, you can specify a format string
containing the following escapes:

    %f for the filename
    %d description
    %m mime type

Alignment is not available when using this,
you need to post-process the output to do that.

=item B<--stdin>

Determine type of content from STDIN, less powerful then normal file checking
because it only uses magic typing. This will happen also if the STDIN filehandle
is a pipe.

To use this option L<IO::Scalar> needs to be installed.

=item B<-v>, B<--version>

Print the version of the program and exit.

=back

=head1 ENVIRONMENT

=over 4

=item XDG_DATA_HOME

=item XDG_DATA_DIRS

These variables can list base directories to search for data files. The shared
mime-info will be expected in the "mime" sub directory of one of these
directories. If these are not set, there will be searched for the
following directories:

    $HOME/.local/share/mime
    /usr/local/share/mime
    /usr/share/mime

See also the "XDG Base Directory Specification"
L<http://freedesktop.org/Standards/basedir-spec>

=back

=head1 FILES

The base dir for all data files is determined by two environment variables,
see L</ENVIRONMENT>.

=over 4

=item F<BASE/mime/packages/SOURCE.xml>

All other files are compiled from these source files. To re-compile them
use B<update-mime-database(1)>.

=item F<BASE/mime/globs>

Compiled information about globs.

=item F<BASE/mime/magic>

Compiled information about magic numbers.

=item F<BASE/mime/MEDIA/SUBTYPE.xml>

Descriptions of a mimetype in multiple languages, used for the
L</--describe> switch.

=back

=head1 DIAGNOSTICS

If a file has an empty mimetype or an empty description,
most probably the file doesn't exist and the given name
doesn't match any globs. An empty description can also mean that
there is no description available in the language you specified.

The program exits with a non-zero exit value if either the commandline
arguments failed, a module it depends on wasn't found or the shared
mime-info database wasn't accessible. See L<File::MimeInfo> for more details.

=head1 TODO

The '--all' switch doesn't really show all matches, but only one per
mime-typing method. This needs to be implemented in the modules first.

=head1 BUGS

If you find bugs, please file them in our Github
issue tracker at L<https://codeberg.org/michielb/File-MimeInfo/issues>.

B<mimetype> doesn't provide a switch for looking inside compressed files
because it seems to me that this can only be done by un-compressing the file,
something that defeats the purpose. On the other hand the option should
exist for strict compatibility with file(1). Possibly a subclass should be
made for this one day.

=head1 AUTHOR

Jaap Karssenberg E<lt>pardus@cpan.orgE<gt>
Maintained by Michiel Beijen E<lt>mb@x14.nlE<gt>

=head1 COPYRIGHT

Copyright (c) 2003, 2012 Jaap G Karssenberg. All rights reserved.
Copyright (c) 2013-2026 Michiel W. Beijen. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

=head1 SEE ALSO

L<file(1)>,
L<update-mime-database(1)>,
L<File::MimeInfo(3)>,
L<http://freedesktop.org/Software/shared-mime-info>



( run in 0.572 second using v1.01-cache-2.11-cpan-8f98c5d2c55 )