Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^2: Download big file in chunks with plack response

by Anonymous Monk
on Apr 26, 2021 at 08:29 UTC ( [id://11131722]=note: print w/replies, xml ) Need Help??


in reply to Re: Download big file in chunks with plack response
in thread Download big file in chunks with plack response

here is the final code:

Correction ;)

my $app = sub { use Path::Tiny qw/ path /; use File::MimeInfo qw/ mimetype /; my $env = shift; my $path_file = 'win.iso'; my $content_type = mimetype($path_file) || 'application/octet-stre +am'; my $basename = path($path_file)->basename; $basename =~ s{[^\w\.-]+}{_}g; my $filehandle = path($path_file)->openr_raw ; return [ 200, [ 'Content-Type' => $content_type, 'Content-Length' => -s $filehandle, 'Content-Disposition' => qq[attachment; filename="$basenam +e"], ], $filehandle ]; };

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11131722]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (None)
    As of 2024-04-19 00:02 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found