The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

MIME

Nile::MIME - Handle MIME Types

SYNOPSIS

    # get mime object instance
    $mime = $app->mime;

    # get mime type for a file from its extension
    $mime_type = $mime->for_file("filename.zip");
    # application/zip

    # get mime type by name
    $mime_type = $mime->for_name('xml');
    # application/xml

    # add custom mime type
    $mime->add_type(foo => "text/foo");

    # add an alias to an existing type
    $mime->add_alias(bar => "foo");

    @exts = $mime->extensions();

DESCRIPTION

Nile::MIME - Handle MIME Types. This module extends MIME::Types and all its methods are available.

for_file

    $mime_type = $mime->for_file('filename.pdf');

Returns the mime type for a file, based on a file extension.

for_name

    $mime_type = $mime->for_name('pdf');

Returns the mime type for a standard or a custom mime type.

add_type

    # add nonstandard mime type
    $mime->add_type(foo => "text/foo");

Add a custom mime type or overrides an existing one.

add_alias

    # add alias to standard or previous alias
    $mime->add_alias( my_jpg => 'jpg' );

Adds an alias to an existing mime type.

Bugs

This project is available on github at https://github.com/mewsoft/Nile.

HOMEPAGE

Please visit the project's homepage at https://metacpan.org/release/Nile.

SOURCE

Source repository is at https://github.com/mewsoft/Nile.

ACKNOWLEDGMENT

This module is based on MIME::Types and Dancer::MIME

SEE ALSO

See Nile for details about the complete framework.

AUTHOR

Ahmed Amin Elsheshtawy, احمد امين الششتاوى <mewsoft@cpan.org> Website: http://www.mewsoft.com

COPYRIGHT AND LICENSE

Copyright (C) 2014-2015 by Dr. Ahmed Amin Elsheshtawy احمد امين الششتاوى mewsoft@cpan.org, support@mewsoft.com, https://github.com/mewsoft/Nile, http://www.mewsoft.com

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.