Mojolicious::Plugin::RenderFile - "render_file" helper for Mojolicious
# Mojolicious $self->plugin('RenderFile'); # Mojolicious::Lite plugin 'RenderFile'; # In controller $self->render_file(filepath => '/tmp/files/file.pdf'); # file name will "file.pdf" # Provide any file name $self->render_file(filepath => '/tmp/files/file.pdf', 'filename' => 'report.pdf');
Mojolicious::Plugin::RenderFile is a Mojolicious plugin that adds "render_file" helper. It does not read file in memory and just streaming it to client.
render_file
$self->render_file(filepath => '/tmp/files/file.pdf', 'filename' => 'report.pdf');
With this helper you can easily provide files for download. By default content-type is "application/x-download". Therefore, a browser will ask where to save file.
This plugin respects HTTP Range headers.
Register plugin in Mojolicious application.
Viktor Turskyi <koorchik@cpan.org>
Nils Diewald (Akron)
Please report any bugs or feature requests to Github https://github.com/koorchik/Mojolicious-Plugin-RenderFile
Mojolicious, Mojolicious::Guides, http://mojolicio.us.
To install Mojolicious::Plugin::RenderFile, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mojolicious::Plugin::RenderFile
CPAN shell
perl -MCPAN -e shell install Mojolicious::Plugin::RenderFile
For more information on module installation, please visit the detailed CPAN module installation guide.