Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Download big file in chunks with plack response

by Thenothing (Sexton)
on Apr 26, 2021 at 00:14 UTC ( [id://11131717]=note: print w/replies, xml ) Need Help??


in reply to Download big file in chunks with plack response

Updated in the end
  • Comment on Re: Download big file in chunks with plack response

Replies are listed 'Best First'.
Re^2: Download big file in chunks with plack response
by Anonymous Monk on Apr 26, 2021 at 08:29 UTC

    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://11131717]
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: (4)
As of 2024-04-25 15:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found